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

Passing ${NODE_NAME} as Node Parameter to downstream job not possible on master

    Details

    • Similar Issues:

      Description

      We use the node label parameter plugin to pass the name of the node where the compile of a software project ran to the downstream jobs to build installlers, apply labels on the SCM and so on (to use the same workspace). Unfortunately this does not work if the compile job runs on master because ${NODE_NAME} is empty there. Is it possible to fix this somehow by having master as default if the passed string is empty f.i.? Or is there some other environment variable I could use for this purpose? If the master job runs on master the downstream jobs will wait forever looking for a node with label ""...

        Attachments

          Activity

          bruce Dirk Kuypers created issue -
          Hide
          domi Dominik Bartholdi added a comment -

          sorry, I'm not fully able to follow your description.
          how do you pass the name to the followup jobs?
          how can I reproduce this?

          Show
          domi Dominik Bartholdi added a comment - sorry, I'm not fully able to follow your description. how do you pass the name to the followup jobs? how can I reproduce this?
          Hide
          bruce Dirk Kuypers added a comment -

          I have a label for the starting job named "clearcase" because we use clearcase and it is only available on some of my slaves with most CPU/disk power and on the master. So it is possible for the job to start on 3 out of 8 slaves and the master. After updating the sources and compiling everything two other jobs are started: One to build the installer and another one to apply a label for the successful build to all files used for the build. So I need the work space of the successful build for those two depending jobs. I pass the name of the host where the job ran via NodeLabel parameter to the downstream jobs: ${HOSTNAME}=${NODE_NAME}. ${NODE_NAME} is empty on the master which leads to downstream jobs waiting forever because they cannot find a node named "".

          I tried to mess around a bit with groovy and set ${NODE_NAME} environment variable as post-build if empty, but did not succeed.:-/

          Show
          bruce Dirk Kuypers added a comment - I have a label for the starting job named "clearcase" because we use clearcase and it is only available on some of my slaves with most CPU/disk power and on the master. So it is possible for the job to start on 3 out of 8 slaves and the master. After updating the sources and compiling everything two other jobs are started: One to build the installer and another one to apply a label for the successful build to all files used for the build. So I need the work space of the successful build for those two depending jobs. I pass the name of the host where the job ran via NodeLabel parameter to the downstream jobs: ${HOSTNAME}=${NODE_NAME}. ${NODE_NAME} is empty on the master which leads to downstream jobs waiting forever because they cannot find a node named "". I tried to mess around a bit with groovy and set ${NODE_NAME} environment variable as post-build if empty, but did not succeed.:-/
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: imod
          Path:
          pom.xml
          src/main/java/org/jvnet/jenkins/plugins/nodelabelparameter/parameterizedtrigger/NodeLabelBuildParameter.java
          http://jenkins-ci.org/commit/nodelabelparameter-plugin/bb5a1c9bf91e22a801d298637582ebb277c61cf0
          Log:
          [FIXED JENKINS-14109] Passing NODE_NAME as Node Parameter to downstream job not possible on master

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: pom.xml src/main/java/org/jvnet/jenkins/plugins/nodelabelparameter/parameterizedtrigger/NodeLabelBuildParameter.java http://jenkins-ci.org/commit/nodelabelparameter-plugin/bb5a1c9bf91e22a801d298637582ebb277c61cf0 Log: [FIXED JENKINS-14109] Passing NODE_NAME as Node Parameter to downstream job not possible on master
          scm_issue_link SCM/JIRA link daemon made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 144740 ] JNJira + In-Review [ 191156 ]
          Hide
          dhruvit01 Dhruvit Patel added a comment -

          I am not very sure how to use this fix. But I am in urge to use this. I need to pass the node_name as a parameter to all the down stream projects in my pipeline.
          Any help to explain how to use this fix???

          Thanks in advanced!!

          Show
          dhruvit01 Dhruvit Patel added a comment - I am not very sure how to use this fix. But I am in urge to use this. I need to pass the node_name as a parameter to all the down stream projects in my pipeline. Any help to explain how to use this fix??? Thanks in advanced!!
          Hide
          imod Dominik Bartholdi added a comment -

          Dhruvit Patel this was fixed way back in 2012 - so any recent version of the nodelabel plugin will have that included, nothing you have to do in particular - just use a recent version.

          If it does not work for you, please open a new issue and explain the problem in more detail

          Show
          imod Dominik Bartholdi added a comment - Dhruvit Patel this was fixed way back in 2012 - so any recent version of the nodelabel plugin will have that included, nothing you have to do in particular - just use a recent version. If it does not work for you, please open a new issue and explain the problem in more detail
          Hide
          dhruvit01 Dhruvit Patel added a comment -

          I might not be configuring it correctly. What I am trying to achieve is : Pass two parameters as two nodes and rest of down stream projects should be populated with the variables. Would you please guide me on this.
          Thanks!!

          Show
          dhruvit01 Dhruvit Patel added a comment - I might not be configuring it correctly. What I am trying to achieve is : Pass two parameters as two nodes and rest of down stream projects should be populated with the variables. Would you please guide me on this. Thanks!!

            People

            • Assignee:
              domi Dominik Bartholdi
              Reporter:
              bruce Dirk Kuypers
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: