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

Predefined parameters not passing correct NODE_LABELS environment variable information.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins version 1.482 running on CentOS 5.8

      The value of "master" gets passed to the down stream job when you define NODE_LABELS in the Predefined parameters section of an upstream job.

      See attached screenshot showing the "Predefined parameters section" of the upstream job and the console output of the downstream job.

          [JENKINS-15749] Predefined parameters not passing correct NODE_LABELS environment variable information.

          Jason Stanley created issue -

          Jason Stanley added a comment -

          As you can see, I have $NODE_LABELS as a predefined parameter.

          Jason Stanley added a comment - As you can see, I have $NODE_LABELS as a predefined parameter.
          Jason Stanley made changes -
          Attachment New: Upstream job predefined parameters.jpg [ 22805 ]

          Jason Stanley added a comment -

          You can see the value for Node Label is "master".

          This is incorrect, see next screenshot for environment variable output from upstream build.

          Jason Stanley added a comment - You can see the value for Node Label is "master". This is incorrect, see next screenshot for environment variable output from upstream build.
          Jason Stanley made changes -
          Attachment New: Downstream project console output..jpg [ 22806 ]

          Jason Stanley added a comment -

          Please ignore first screenshot showing Predefined parameters section as the $NL was set incorrectly, it is now just NL=$NODE_LABELS.

          Jason Stanley added a comment - Please ignore first screenshot showing Predefined parameters section as the $NL was set incorrectly, it is now just NL=$NODE_LABELS.

          Jason Stanley added a comment -

          Correct NODE_LABEL value from upstream build.

          Jason Stanley added a comment - Correct NODE_LABEL value from upstream build.
          Jason Stanley made changes -
          Attachment New: NODE_LABEL value from upstream build..jpg [ 22807 ]

          cjo9900 added a comment -

          From your description the issue is that you indicate that "master" should not be in the list of labels.

          However the list of labels does includes the self label (which is the name of slave its self) as indicated in getAssignedLabels()[1] which is called from the CoreEnvironmentContributor[3].

          So in this case I don't think this is an error, as I assume that upstream job was run on master.

          [1] http://javadoc.jenkins-ci.org/hudson/model/Node.html#getAssignedLabels()
          [2] http://javadoc.jenkins-ci.org/hudson/model/Node.html#getSelfLabel()
          [3] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/CoreEnvironmentContributor.java#L56

          cjo9900 added a comment - From your description the issue is that you indicate that "master" should not be in the list of labels. However the list of labels does includes the self label (which is the name of slave its self) as indicated in getAssignedLabels() [1] which is called from the CoreEnvironmentContributor [3] . So in this case I don't think this is an error, as I assume that upstream job was run on master. [1] http://javadoc.jenkins-ci.org/hudson/model/Node.html#getAssignedLabels( ) [2] http://javadoc.jenkins-ci.org/hudson/model/Node.html#getSelfLabel( ) [3] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/model/CoreEnvironmentContributor.java#L56

          Jason Stanley added a comment -

          In this case, the upstream job was not run on the master but a slave.

          If you look at the screenshot of the job output, you will see the value of NODE_LABELS is not master, but the name of the slave which the job is running on.

          All of the other environment variables are correctly passed to the downstream job except this one.

          Jason Stanley added a comment - In this case, the upstream job was not run on the master but a slave. If you look at the screenshot of the job output, you will see the value of NODE_LABELS is not master, but the name of the slave which the job is running on. All of the other environment variables are correctly passed to the downstream job except this one.

            cjo9900 cjo9900
            jaystan Jason Stanley
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: