We have the same situation. We would love to use Active Choice directly with our pipeline. We got it working for simple stuff using:
properties([parameters([ [$class: 'org.biouno.unochoice.ChoiceParameter', name: 'Ambiente', choiceType: 'PT_RADIO', description: 'Escolha para qual ambiente o artefato devera ser implantado.', filterLength: 1, filterable: false, randomName: 'choice-parameter-47910233643731', script: [ $class: 'org.biouno.unochoice.model.GroovyScript', script:[ $class:'SecureGroovyScript', script:'''return ["desenvolvimento:selected", "alfa", "beta", "producao"]''' ] ] ] ,[$class: 'org.biouno.unochoice.CascadeChoiceParameter', name: 'Servidores', choiceType: 'PT_CHECKBOX', description: 'Escolha o pool ou servidores alvo.', filterLength: 1, filterable: false, randomName: 'choice-parameter-51976913619136', referencedParameters: 'Ambiente', script: [ $class: 'org.biouno.unochoice.model.GroovyScript', script:[ $class:'SecureGroovyScript', script:'''if ("desenvolvimento".equals(Ambiente)) { return ["POOL-DESENV","D001", "D002", "D003", "D004"] } else if ("alfa".equals(Ambiente)) { return ["alfa:selected"] } else if ("beta".equals(Ambiente)) { return ["beta:selected"] } else if ("producao".equals(Ambiente)) { return ["producao:selected"] } else { return [] }''' ], fallbackScript:[ $class: 'SecureGroovyScript', script: '''return["Erro na carga de servidores"]''' ] ] ]
Working groovy as a string in the pipeline is a pain. Having to authorize this script every time you change the groovy code. If you have shared library support you don't have to ever change these scripts because de shared lib will be the one changing. And then all our code will be groovy from git. Much easier to maintain. Is there a way to try an Active Choice with this feature? Or a timeline for this feature if ever. |