Add the api method to configure the 'Active Choices Reactive Parameter' 'Use Groovy Sandbox' attribute

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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)
        }
      } 

       

            Assignee:
            Jamie Tanna
            Reporter:
            Harvy
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: