-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: job-dsl-plugin
-
None
-
Environment:Jenkine Version: 2.440.1
Job DSLVersion: 1.87
Currently whenever the Job is configured with 'Active Choices Reactive Parameter' the default is 'Use Groovy Sandbox' is unselected, which is essential for the active choice proper functionality.
Â
Example job:
Â
pipelineJob('DynamicChoiceJob-DSL') { Â description('Test Job used for temporarily testing any pipeline run using the replay functionality') Â logRotator { Â Â numToKeep(120) Â Â daysToKeep(60) Â } Â parameters { Â Â booleanParam { Â Â Â name('RUN_TESTS') Â Â Â description('Run tests') Â Â Â defaultValue(true) Â Â } Â Â activeChoiceReactiveParam('TEST_TYPES') { Â Â Â description('Dynamic Test types based on the Run tests param') Â Â Â choiceType('CHECKBOX') Â Â Â referencedParameter('RUN_TESTS') Â Â Â groovyScript { Â Â Â Â Â Â Â Â Â Â script("""\ Â Â Â Â Â if(RUN_TESTS) { Â Â Â Â Â Â return ['default', 'code_coverage', 'newman'] Â Â Â Â Â } else { Â Â Â Â Â Â return [] Â Â Â Â Â } Â Â Â Â """.stripIndent()) Â Â Â Â Â Â Â Â Â Â Â Â Â } Â Â } Â } }
Â
The result job is configured with the 'Use Groovy Sandbox' is unselected, which whenever the RUN_TESTS is selected/unselected nothing happens while when  'Use Groovy Sandbox' is manually selected in Job config. the functionality started to work as expected. (screen shots)
Â
Â
Feature:
Add the sandbox api method to the script and fallbackScript
e.g.
groovyScript {
script {
script(String)
sandbox(Boolean)
}
fallbackScript {
script(String)
sandbox(Boolean)
}
}
Â