2

I am following the answers in Active Choices Reactive Reference Parameter in jenkins pipeline. I have 3 parameters, where one depends on the answer of the others.

...
properties([
    parameters([
        [$class: 'ChoiceParameter', 
            choiceType: 'PT_SINGLE_SELECT', 
            description: 'Select the environment Name from the Dropdown List', 
            filterLength: 1, 
            filterable: true,
            name: 'environment', 
            script: [
                $class: 'GroovyScript', 
                fallbackScript: [
                    classpath: [], 
                    sandbox: false, 
                    script: 
                        'return "Could not get Env"'
                    ], 
                script: [
                    classpath: [], 
                    sandbox: false, 
                    script: 
                    """
                       return ["TST", "PRD"]
                    """
                ]
            ]
        ], 
...

However not even the first parameter shows any values, where I would expect environment contains TST and PRD.

enter image description here

papanito
  • 2,349
  • 2
  • 32
  • 60

1 Answers1

4

Ok the problem is relvealed when looking into the logfile:

Oct 08, 2019 9:57:18 AM org.biouno.unochoice.model.GroovyScript eval
WARNING: Error executing fallback script
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:474)
...

So once the scripts are approved via Manage Jenkins > In-process Script Approval all works fine

papanito
  • 2,349
  • 2
  • 32
  • 60