How to create drop-down list in Jenkins with predefined items.
Prerequisites:
Step 1: create in Global properties at http://jenkins.domain.org/configure 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
nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
envVars = nodes[0].envVars
return "${envVars['PROJECTS']}".split(',')
Step 3: Enjoy!
Top comments (0)