import jenkins.model.*
instance = Jenkins.getInstance()
globalNodeProperties = instance.getGlobalNodeProperties()
myParam = 'Not Set'
globalNodeProperties.each {
envVars = it.getEnvVars()
if (envVars.get('ENV_VAR_NAME') != null) {
myParam = envVars.get('ENV_VAR_NAME');
}
}
if (myParam) {
// Assuming the environment variable is a comma-separated string like "option1,option2,option3"
return myParam.split(',').collect{ it.trim() }
} else {
return ["Environment variable not set or empty"]
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter