How can I use the Extended Choice Parameter plugin in a Jenkins pipeline script?

前端 未结 6 1811
暖寄归人
暖寄归人 2021-02-02 09:01

The Extended Choice Parameter plugin is great and I use it in jobs configured via the UI https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin

How

6条回答
  •  不思量自难忘°
    2021-02-02 09:34

    Navigate to your http://jenkins-url.com/pipeline-syntax.

    On the Sample step dropdown select 'Properties: Set job properties'

    There is a checkbox for 'This project is parameterized', then you can select Add parameter > Extended Choice Parameter. Add the menu items there then click 'Generate Pipeline Script' to convert.

    Trim it so you remove the 'properties([parameters([' before and the '])])' after:

    extendedChoice(defaultValue: 'whatif', description: 'Run as what if?', multiSelectDelimiter: ',', name: 'whatif', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_SINGLE_SELECT', value: 'whatif, LIVE', visibleItemCount: 2)
    

提交回复
热议问题