Issue accesing variable inside script in ActiveChoice plugin (ver2.4)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Issue accesing variable inside script in ActiveChoice plugin (ver2.4)

chencho m-a
Hi all, 

I have a script which is writting the configuration of ActiveChoice instead of use the browser. 

So I am sending a hashmap as parameters but I am unable to acces it inside the script 

def components_param(hash_map){ // Section header
    return [$class: 'DynamicReferenceParameter',
            choiceType: 'ET_FORMATTED_HTML', 
            description: '', 
            name: '', 
            randomName: "choice-parameter-${UUID.randomUUID()}",
            omitValueField: false,
            referencedParameters: 'sdk',
            script: [
                $class: 'GroovyScript',
                fallbackScript: [
                    classpath: [], sandbox: false, script: 'return ["Error,can\'t retrieve components"]',
                script: [
                    classpath: [], sandbox: false, script:'''
def output="<font size='3'><b>Components to be updated ${sdk}</b></font><ul>"
for (comp in  '''+hash_map+'''[sdk].keySet()) {
        output += "<li>"+comp+"</li>"

return output

If I check the content in jenkins UI, i got this error:

startup failed:
Script1: 3: illegal colon after argument expression;
   solution: a complex label expression before a colon must be parenthesized @ line 3, column 43.

The hash_map in jenkins UI takes this form:

 [devel:[extensions:[extension1:[data:[name:name1, type:generic], sdk-ext:sdk-ext-extension1-devel,  extension1-release: extension1-sdk-, ...

How can I parse this hashmap inside ActiveChoice script? In any groovy console is something like:

for (comp in hash_map[sdk].keySet()) {
    println comp

Any help will be appreciated

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit