Hi,
I`d like to create a seed job with some active choices parameter which populates the list with groovy script.
My problem is how to use multiple lines in groovy script part? The #2 would be more readable but not works.
#1
This will work but hard to read!
parameters {
activeChoiceParam('NODE_NAME') {
description('Select Node')
filterable()
choiceType('SINGLE_SELECT')
groovyScript {
script(' import jenkins.*\r\n import jenkins.model.*\r\n import hudson.*\r\n import hudson.model.*\r\n def nodes = Jenkins.instance.nodes.findAll()\r\n return nodes*.name')
fallbackScript('"Error in script"')
}
}
}
#2
This won`t work but nicer!
parameters {
activeChoiceParam('NODE_NAME') {
description('Select Node')
filterable()
choiceType('SINGLE_SELECT')
groovyScript {
script('
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
def nodes = Jenkins.instance.nodes.findAll()
return nodes*.name
')
fallbackScript('"fallback choice"')
}
}
}