Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29363

Groovy Post Build and Label Parameter

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hi there

      I'm running Jenkins version 1.565.2

      I'm having a strange problem when dynamically triggering downstream projects

      I have created a job 'Sports - Core - Scheduled' which accepts 2 parameters.
      One - called 'Stream' which is for our stream(Source Control stream). This is a choice parameter
      Two - called 'Product' which is for our products(that we build in our company). This is a Label parameter having 10 nodes(servers) associated to it.

      When i build this job manually, Jenkins recognises the Label parameter and automatically picks one of the free node from the label and everything works fine.

      We have about 300 of these sort of jobs for various streams/products scenarios for which i'm writing a Groovy script which calls all these jobs to run dynamically but the following script below is failing to recognise the label parameter and actually assigning someother node which is not even associated with the 'product' label.

      Any idea what i'm doing wrong or what do i need to do to ensure i can pass a label parameter successfully to the script below.

      I'm a newbie but i can provide more details if need be.

      import hudson.model.*;
      import jenkins.model.*;
      import jenkins.*;

      // Core Test run
      job = Hudson.instance.getJob('Sports - Core - Scheduled');
      timer =60
      time=1;
      WholeParams = [
      ["Core-Test","Sports"]
      ]
      for (i in WholeParams)

      { params = [] params += new hudson.model.StringParameterValue('Stream', i[0]) params += new hudson.model.StringParameterValue('Product', i[1]) paramsAction = new hudson.model.ParametersAction(params) cause = new hudson.model.Cause.UpstreamCause(manager.build) causeAction = new hudson.model.CauseAction(cause) manager.hudson.queue.schedule(job,time, causeAction, paramsAction); time=time+timer; }

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          This is an issue tracker, not a support site. Please ask your questions on the jenkinsci-users mailing list (as you already did), or in #jenkins on Freenode.

          Hint: If you want to have a Label Parameter, don't use a String Parameter.

          Show
          danielbeck Daniel Beck added a comment - This is an issue tracker, not a support site. Please ask your questions on the jenkinsci-users mailing list (as you already did), or in #jenkins on Freenode. Hint: If you want to have a Label Parameter, don't use a String Parameter.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            captedgar capt edgar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: