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

EnvInject undefines NODE_NAME environment variable on master

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • envinject-plugin
    • None
    • Windows 7, 64 bit

      I have quite a lot of jobs which can roam around between master and about 20 Slaves. The initial job updates an SCM view and compiles the software and starts depending jobs like building an installer. The installer job needs to know on which node to run which it is told by using the parameterized trigger plugin and the node label parameter plugin. After upgrading to latest Jenkins 1.527 this mechanism is broken at least for a Windows 7/64 bit master.

      I had similar problems about a year ago, see JENKINS-14109. Maybe this is helpful.

      Downgrading to 1.526 fixes the issue, so there must be a change in core which caused this. The only suspect from the changes I can see is JENKINS-19042

          [JENKINS-19222] EnvInject undefines NODE_NAME environment variable on master

          Daniel Beck added a comment -

          Is anyone here experiencing this specific problem on recent Jenkins versions and doesn't have env-inject installed? Otherwise this should probably be reassigned to the envinject component.

          Daniel Beck added a comment - Is anyone here experiencing this specific problem on recent Jenkins versions and doesn't have env-inject installed? Otherwise this should probably be reassigned to the envinject component.

          I can confirm I have this problem on jenkins 1.575 and indeed I also have envinject 1.89. Whichever plugin causes this, it would be nice to have it fixed.

          Arnt Witteveen added a comment - I can confirm I have this problem on jenkins 1.575 and indeed I also have envinject 1.89. Whichever plugin causes this, it would be nice to have it fixed.

          Daniel Beck added a comment -

          Still occurs on 1.580 with Envinject 1.90; while the plugin is disabled, the environment variable NODE_NAME is set.

          Updated issue title to match recent comments' information.

          Daniel Beck added a comment - Still occurs on 1.580 with Envinject 1.90; while the plugin is disabled, the environment variable NODE_NAME is set. Updated issue title to match recent comments' information.

          Alex Earl added a comment - Looks like it's this code right here: https://github.com/jenkinsci/envinject-plugin/blob/edfdceb87e012856ae9c777e1117aec310be5493/src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java#L41 Should probably look more like this: https://github.com/jenkinsci/jenkins/blob/84c76253862a2f36f813a7aa45b77d99c1616be4/core/src/main/java/jenkins/model/CoreEnvironmentContributor.java#L57

          Alex Earl added a comment -

          I submitted a pull request that should fix this. https://github.com/jenkinsci/envinject-plugin/pull/39

          Alex Earl added a comment - I submitted a pull request that should fix this. https://github.com/jenkinsci/envinject-plugin/pull/39

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java
          http://jenkins-ci.org/commit/envinject-plugin/63389901c85ba6c1a903e25df5fe3f815e4c1b36
          Log:
          Fix JENKINS-19222

          Make setting the NODE_NAME similar to what core does.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java http://jenkins-ci.org/commit/envinject-plugin/63389901c85ba6c1a903e25df5fe3f815e4c1b36 Log: Fix JENKINS-19222 Make setting the NODE_NAME similar to what core does.

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java
          http://jenkins-ci.org/commit/envinject-plugin/4260b55f4cf0f89910fd61d0ae3a0cedbfeda3f5
          Log:
          Merge pull request #39 from slide/master

          Fix JENKINS-19222

          Compare: https://github.com/jenkinsci/envinject-plugin/compare/de93818b4007...4260b55f4cf0

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java http://jenkins-ci.org/commit/envinject-plugin/4260b55f4cf0f89910fd61d0ae3a0cedbfeda3f5 Log: Merge pull request #39 from slide/master Fix JENKINS-19222 Compare: https://github.com/jenkinsci/envinject-plugin/compare/de93818b4007...4260b55f4cf0

          I tried this again with the merged pull request from Alex Earl and the bug seems to be fixed on my end. In our case, our Perforce SCM configuration uses ${NODE_NAME} to generate workspaces for each machine - but polling was broken on the master.

          Thanks!

          Christopher McGrath added a comment - I tried this again with the merged pull request from Alex Earl and the bug seems to be fixed on my end. In our case, our Perforce SCM configuration uses ${NODE_NAME} to generate workspaces for each machine - but polling was broken on the master. Thanks!

          Oleg Nenashev added a comment -

          Does anybody still see this issue?

          Oleg Nenashev added a comment - Does anybody still see this issue?

          pjdarton added a comment -

          This sounds like a manifestation of the more generic bug JENKINS-24283 - variables with empty values get unset.  I'd guess that fixing that one would fix this one.

          pjdarton added a comment - This sounds like a manifestation of the more generic bug JENKINS-24283 - variables with empty values get unset.  I'd guess that fixing that one would fix this one.

            gbois Gregory Boissinot
            bruce Dirk Kuypers
            Votes:
            6 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: