Created
June 2, 2022 20:30
-
-
Save pwalkr/664a67a00ca2176fe7c649f1fdef61e7 to your computer and use it in GitHub Desktop.
Jenkins - get list of parameters from internal memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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