I’m using the Jenkins Active Choices plugin to create dynamic parameters in my Jenkins pipeline. However, I’m encountering an issue with the checkbox values being returned as booleans (true, false) instead of the actual values specified in the HTML form.
Here’s the relevant piece of code from my Jenkinsfile:
[$class: 'ChoiceParameter',
choiceType: 'PT_RADIO',
description: 'Select the Testing Mechanism',
filterLength: 1,
filterable: false,
name: 'TESTING_METHOD',
script: [
$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: false,
script: "return['Could not get the testing method']"
],
script: [
classpath: [],
sandbox: false,
script: "return['Files','Tags']"
]
]
],
[$class: 'DynamicReferenceParameter',
choiceType: 'ET_FORMATTED_HTML',
omitValueField: true,
description: 'Select the test suit you want to run',
name: 'TAGS',
referencedParameters: 'TESTING_METHOD',
script: [
$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: false,
script: "return['Could not get The environments']"
],
script: [
classpath: [],
sandbox: false,
script: """
if (TESTING_METHOD.equals('Tags')) {
return '<form>' +
'<input name="value" type="checkbox" value="fast"> Fast<br>' +
'<input name="value" type="checkbox" value="slow"> Slow<br>' +
'<input name="value" type="checkbox" value="Medium"> Medium<br>' +
'<input name="value" type="checkbox" value="Rapid"> Rapid<br>' +
'</form>'
} else {
return '<input name="value" type="text" value="Intel Core i5" disabled>'
}
"""
]
]
],
Problem:
When selecting values from the checkboxes, the values are returned as true, true, false, false instead of the actual checkbox values (fast, slow, etc.).
Expected Behavior:
The selected checkbox values should be returned as their respective values (fast, slow, Medium, Rapid).
Current Behavior:
The checkbox selections are returned as booleans (true for checked, false for unchecked).
UI for my jenkins job using the active choice parameter
console output when printing the TAGS
Question:
How can I modify the script or configuration so that the actual checkbox values are returned instead of booleans?
Any help or suggestions on how to resolve this issue would be greatly appreciated!
Thank you!
I’m using the Jenkins Active Choices plugin to create dynamic parameters in my Jenkins pipeline. However, I’m encountering an issue with the checkbox values being returned as booleans (true, false) instead of the actual values specified in the HTML form.
Ranveer Raj is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.