Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

functions in build variable prompts #3696

Varal ·
Hi everyone!
I'm constructing a new configuration which will prompt the user for a few things to input. One of the things is "subconfigurations to delete" which is a multi-selection box. I want to populate the content of this multi-selection box using the following code:

${
groovy:
def srcConf = vars.getValue("srcConf").toString()
def parent = system.getConfigurationManager().get(srcConf)
def configurations = []
getAllConfigurations parent, configurations

def getAllConfigurations(Configuration parent, ArrayList configurations) {
parent.getChildren().each { child ->
child.each {configurations.add it}
getAllConfigurations child, configurations
}
}

return configurations


however I'm getting an error saying th following:


Message: Failed to evaluate below expression in configuration 'root/ProcessTeam/CreateNewReleaseBranch':

groovy:
def srcConf = vars.getValue("srcConf").toString()
def parent = system.getConfigurationManager().get(srcConf)
def configurations = []
//def children = parent.getChildren()

getAllConfigurations parent, configurations

def getAllConfigurations(Configuration parent, ArrayList configurations) {
parent.getChildren().each { child ->
child.each {configurations.add it

Root cause:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script1484305651735419712833.groovy: 11: expecting '}', found '' @ line 11, column 42.
ld.each {configurations.add it
^

1 error


Any ideas? <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
  • replies 2
  • views 934
  • stars 0
Laba42 ·
When you start a groovy script with ${ you must escape the closing curly braces ( except for the last) with an backspace "\"

${
groovy:
def srcConf = vars.getValue("srcConf").toString()
def parent = system.getConfigurationManager().get(srcConf)
def configurations = []
getAllConfigurations parent, configurations

def getAllConfigurations(Configuration parent, ArrayList configurations) {
parent.getChildren().each { child ->
child.each {
configurations.add it
\}
getAllConfigurations child, configurations
\}
\}
return configurations
}
Varal ·
Bah! I forgot something so obvious! Thank you!