Using an arbitrary plugin in Jenins 2 Pipeline scripts

狂风中的少年 提交于 2019-12-02 01:02:07

问题


Using the Snippet Generator tool in Jenkins 2, I can setup a plugin like I would within a job, and then it will generate me the Groovy I can use in my Pipeline script.

But what if the plugin I am interested in instrumenting isn't listed in the "Sample Step" drop down in the Snippet Generator? How do I determine how to create a script block to instrument the plugin I want to use?

In my case, I would like to use the "Flexible Publish" plugin within my Pipeline script.


回答1:


You can't use plugins which are not compatible with pipeline generally. Plugins need to be modified more or less to be compatible. See https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md




回答2:


To be complete you need to know that snippet generator only shows compatible plugins that declare a specific help page in plugin's code. If we take the example of docker-workflow plugin, you can see in the code that it defines a help page for DockerDSL, which means that a Snippet Generator will be available for DockerDSL step.

Therefore you should always check Jenkins plugins compatibility page (as arasio mentionned it) and not what you see in Snippet Generator.



来源:https://stackoverflow.com/questions/40136583/using-an-arbitrary-plugin-in-jenins-2-pipeline-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!