Skip to content

Instantly share code, notes, and snippets.

@Larusso
Last active September 8, 2016 08:33
Show Gist options
  • Save Larusso/7550775c5e932eb41619fe2242f26b16 to your computer and use it in GitHub Desktop.
Save Larusso/7550775c5e932eb41619fe2242f26b16 to your computer and use it in GitHub Desktop.
Jenkins script that list all parameterized jobs with given parameter.
import hudson.model.*
parameter_name = "DEVELOPER_DIR"
allItems = Hudson.instance.items
allItems.each { job ->
prop = job.getProperty(ParametersDefinitionProperty.class)
if(prop != null) {
allDefinitions = prop.getParameterDefinitions()
filteredDefinitions = allDefinitions.findAll {definition -> definition.name != parameter_name}
appEnvDefinition = prop.getParameterDefinition(parameter_name)
if(appEnvDefinition)
{
println job.name
}
}
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment