Skip to content

Instantly share code, notes, and snippets.

@pwalkr
Created June 2, 2022 20:30
Show Gist options
  • Save pwalkr/664a67a00ca2176fe7c649f1fdef61e7 to your computer and use it in GitHub Desktop.
Save pwalkr/664a67a00ca2176fe7c649f1fdef61e7 to your computer and use it in GitHub Desktop.
Jenkins - get list of parameters from internal memory
static def getBuildParameters(currentBuild) {
def project = currentBuild.getRawBuild().getParent()
def params = null
// Find or create parameters object
for (e in project.properties) {
if (e.value instanceof ParametersDefinitionProperty) {
params = e.value
break
}
}
// If there wasn't one, create and set so we have something to return
if (! params) {
params = new ParametersDefinitionProperty([])
project.addProperty(params)
}
return params.parameterDefinitions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment