I'm trying to control where jobs are run from a groovy script, it's an edge 
case that I have to run on all nodes in a label rather than what's free.  I 
was hoping I could use the nodelabel plugin to do this.

On my slave job I have a label parameter, named and defaults to my label 
that a lot of slaves are hooked up to (Distributed_build), I run as run on 
all nodes matching the label, ignore offline nodes and run regardless of 
result.

I put a machine in there that's part of the label cluster to see if I could 
force to a node (Machine_1) so I could visually see the jobs queued for 
that node rather than using a free node part of the label cluster, but it 
seems to run all builds on the label cluster regardless. Am I doing 
something wrong or just assuming incorrectly how the plugin works?


In my source job I have the following groovy script.

def nodes = [
  "Distributed_build",
  "Distributed_build",
  "Distributed_build",
  "Distributed_build",
  "Distributed_build",
  "Machine_1",
  "Machine_1",
  "Machine_1",
  "Machine_1"
];

def targetJobName = "SuperDuper Job"  
def jobToTrigger = Jenkins.instance.getItem( targetJobName )  

def i=1
nodes.each {
  node ->
    if(jobToTrigger!=null) {
      def futureJob = jobToTrigger.scheduleBuild( 2, new 
Cause.UpstreamCause( build ), new ParametersAction( [
        new StringParameterValue( 'Distribution_Label', node ), 
        new StringParameterValue( 'Build_Command_Line', i.toString() ) 
      ] ) )
      println(futureJob)
    }
    println(node)
    i++
}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6a11af0f-f312-4a5d-9f7c-f1cad4e3b8f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to