Groovy Script - Active Choices Jenkins Plugin - variable reference from inside "script:" section

Viewed 11

I'm using the "Active Choices Jenkins Plugin" in order to realize a pipeline. I've defined my parameters.

[$class: 'DynamicReferenceParameter', 
                        choiceType: 'ET_FORMATTED_HTML', 
                        description: '_description', 
                        name: '_name', 
                        referencedParameters: '**customer**', 
                        script: 
                            [$class: 'GroovyScript', 
                            script: [
                                    sandbox: true, 
                                    script: **MUST INSERT SCRIPT**
                        ]
                ]

Now i go a pretty big script to be processed, that need to evaluate:

A static variabile defined before execution

def customer_dictionary = [
                             "customer1": ["a", "b", "c"], 
                             "customer2": ["a", "b", "c", "d"],
                          ]

A runtime variabile passed through the referencedParameters, "customer" ) .

 customer.each { service->
                    html_to_be_rendered += "<tr><td>"
                    configuration = configuration_dictionary[service]    

                                                           

I've to pass to "script:" a string. But even if i use string interpolation ( """ script """ ) i can't manage to make him resolve this reference ( configuration_dictionary[service] ).

Someone can help me?

Thx

0 Answers
Related