Skip to content

[JENKINS-72885] Add the api method to configure the 'Active Choices Reactive Parameter' 'Use Groovy Sandbox' attribute #2522

@jenkins-infra-bot

Description

@jenkins-infra-bot

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

 


Originally reported by harvynbb, imported from: Add the api method to configure the 'Active Choices Reactive Parameter' 'Use Groovy Sandbox' attribute
  • assignee: jamietanna
  • status: Open
  • priority: Major
  • component(s): job-dsl-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-03
Raw content of original issue

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

 

environment
Jenkine Version: 2.440.1<br/>
Job DSLVersion: 1.87
7 attachments

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions