groovy - Active Choices Reactive Reference Parameter in jenkins pipeline -
i'm using active choices reactive reference parameter plugin in dsl job here code
parameters { activechoiceparam('choice1') { description('select choice') choicetype('radio') groovyscript { script("return['aaa','bbb']") fallbackscript('return ["error"]') } } activechoicereactiveparam('choice2') { description('select choice') choicetype('radio') groovyscript { script("if(choice1.equals("aaa")){return ['a', 'b']} else {return ['aaaaaa','fffffff']}") fallbackscript('return ["error"]') } referencedparameter('choice1') }
and work's fine want how use activechoicereactiveparam in jenkinsfile pipeline job did :
properties( [ [ $class : 'parametersdefinitionproperty', parameterdefinitions: [ [ $class : 'choiceparameterdefinition', choices : 'aaa\nbbb', description: 'select choice : ', name : 'choice1' ]
but how can add choice2 parameter !!!
instead of using active choices reactive reference parameter did , it's work !!
node('slave') { def choice1 def choice2 stage ('select'){ choice1 = input( id: 'userinput', message: 'select choice', parameters: [ [\$class: 'choiceparameterdefinition', choices: 'aa\nbb', description: '', name: ''] ]) if(choice1.equals("aa")){ choice2 = input( id: 'userinput', message: 'select choice', parameters: [ [\$class: 'choiceparameterdefinition', choices: 'yy\nww', description: '', name: ''] ]) }else{ choice2 = input( id: 'userinput', message: 'select choice', parameters: [ [\$class: 'choiceparameterdefinition', choices: 'gg\nkk', description: '', name: ''] ]) } } }
Comments
Post a Comment