Snippets Collections
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"]
}
star

Sat Feb 28 2026 10:33:56 GMT+0000 (Coordinated Universal Time)

#jenkins #build #parameter

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension