DEV Community

Alexei Moussatov
Alexei Moussatov

Posted on

Howto: Drop-down list for values in Jenkins

How to create drop-down list in Jenkins with predefined items.


Step 1: create in Global properties at property with name PROJECTS and comma-separated list of your projects

Step 2: In job configuration add parameter Extended choice parameter
Set name for your parameter (for example JIRA_PROJECT)
Select Groovy script and add next groovy-code

    import jenkins.model.*
    nodes = Jenkins.instance.globalNodeProperties
    envVars = nodes[0].envVars
    return "${envVars['PROJECTS']}".split(',')

Step 3: Enjoy!

Top comments (0)