I used jenkins Active choices plugin and Mavenmetadata plugin to build above UI. When I click a radio button particular version only should be display. How can I write a groovy script to fulfill above requirement?

Below images showing my groovy scripts.




You can use the Jenkins pipeline syntax to get the groovy script. For example below code will generate radio buttons for active choice parameter. you can generate scripts like this from your jenkins instance at http://localhost:8080/pipeline-syntax/. More info is here https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator

def createInputParameters(){
([[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
 parameters([[$class: 'ChoiceParameter', choiceType: 'PT_RADIO', description: '',
 filterLength: 1, filterable: false, name: 'Select_snapshot_or_release',
  randomName: 'choice-parameter-1683871426502398',
   script: [$class: 'GroovyScript', fallbackScript: [classpath: [], sandbox: true, 
    script: 'return "Error"'],
     script: [classpath: [], sandbox: true,
      script: '''return[
             [$class: 'ThrottleJobProperty', categories: [],
              limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, 
               maxConcurrentTotal: 0,
               paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.