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>"
}
output+="</ul>"
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-1.21.0.0-devel, ...
How can I parse this hashmap inside ActiveChoice script? In any groovy console is something like:
sdks=hash_map.keySet()
sdk=sdks[1]
for (comp in hash_map[sdk].keySet()) {
println comp
}
Any help will be appreciated