def list = jenkins.model.Jenkins.instance.slaves.findAll{
if (it.name.contains(project)) it.name
}.collect{it.name}
list.add(0,"None")
return list
import hudson.model.*
def list =""
def runable=false
def build = Thread.currentThread()?.executable
// get the selected node parameter value at runtime
def nodes = build?.actions.find { it instanceof ParametersAction }?.parameters.collect{
(it instanceof StringParameterValue)?it.value:""
} as List
println "node is $nodes"
nodes.unique().removeAll(["None"])
nodes.remove(" ")
nodes.remove("")
if (nodes!=[]) {
list=nodes.join(",").toString()
}
println "list is: $list"
if (list!=" " && list!="") runable=true
println "runable is $runable"
build.addAction( new ParametersAction([new StringParameterValue("runtimeNodes",list)]))
build.addAction( new ParametersAction([new BooleanParameterValue("runable",runable)]))
// get all available nodes if its name contains "client" - specific for our project use;
def nodes = hudson.model.Hudson.instance.slaves.findAll{
if (it.name.contains("Client")) it.name
}.collect{it.name}
nodes.add(0,"None")
// The name of the parameter to set.
name("test")
// A comma separated list of nodes to execute the job on.
nodeListString("\${runtimeNodes}")