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

Env-inject plugin suppress variables contributed by extension points

      Whenever envvar is available on slave (either inherited from system or configured on slave), its value can not be overridden during build by envvar contributing extension points:

      • EnvironmentContributor
      • BuildWrapper
      • possibly others

      This works correctly when envinject is not installed. The culprit seemsto be that EnvInjectPluginAction retains all envvars (not only those envinject contributed) early in the build and put this values back as it implements EnvironmentContributingAction. Any value that was overridden by a plugin is then reset to its original value.

          [JENKINS-26583] Env-inject plugin suppress variables contributed by extension points

          Oleg Nenashev added a comment -

          nfalco Yes, I do the same in https://github.com/jenkinsci/envinject-plugin/pull/124/commits/560c5df32bcdd67570f166312cedbf223b2e6d75 . It does not help new tests, but maybe I'll branch for that and deliver a partial fix

          Oleg Nenashev added a comment - nfalco Yes, I do the same in https://github.com/jenkinsci/envinject-plugin/pull/124/commits/560c5df32bcdd67570f166312cedbf223b2e6d75 . It does not help new tests, but maybe I'll branch for that and deliver a partial fix

          Oleg Nenashev added a comment -

          nfalco carltongbrown I have created another pull request, which solves the failing tests. It is something you could try, and it seems mergeable to me. https://github.com/jenkinsci/envinject-plugin/pull/125 

          Oleg Nenashev added a comment - nfalco carltongbrown I have created another pull request, which solves the failing tests. It is something you could try, and it seems mergeable to me. https://github.com/jenkinsci/envinject-plugin/pull/125  

          Carlton Brown added a comment -

          oleg_nenashev your fix worked for me... built and tested from PR 125.

          Carlton Brown added a comment - oleg_nenashev your fix worked for me... built and tested from PR 125.

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java
          http://jenkins-ci.org/commit/envinject-plugin/178315eea8c952de7594f4258d35e11e3b2f006a
          Log:
          JENKINS-26583 Reproduce in unittest

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java http://jenkins-ci.org/commit/envinject-plugin/178315eea8c952de7594f4258d35e11e3b2f006a Log: JENKINS-26583 Reproduce in unittest

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java
          http://jenkins-ci.org/commit/envinject-plugin/1ab1de604bb3c3b7e291d3c581553cb75827bfbb
          Log:
          JENKINS-26583 More tests

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java http://jenkins-ci.org/commit/envinject-plugin/1ab1de604bb3c3b7e291d3c581553cb75827bfbb Log: JENKINS-26583 More tests

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/EnvInjectListener.java
          src/test/java/org/jenkinsci/plugins/envinject/BuildCauseRetrieverTest.java
          src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java
          http://jenkins-ci.org/commit/envinject-plugin/2948c711b05b68c6a94c334c26fe4e6fdcecda9f
          Log:
          [FIXED JENKINS-26583] Do not capture slave variables

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/main/java/org/jenkinsci/plugins/envinject/EnvInjectListener.java src/test/java/org/jenkinsci/plugins/envinject/BuildCauseRetrieverTest.java src/test/java/org/jenkinsci/plugins/envinject/EnvInjectActionTest.java http://jenkins-ci.org/commit/envinject-plugin/2948c711b05b68c6a94c334c26fe4e6fdcecda9f Log: [FIXED JENKINS-26583] Do not capture slave variables

          Oleg Nenashev added a comment -

          I hope to release the fix on this weekend

          Oleg Nenashev added a comment - I hope to release the fix on this weekend

          Oleg Nenashev added a comment -

          the fix has been released in 2.1.4

          Oleg Nenashev added a comment - the fix has been released in 2.1.4

          There is still an issue with plugin overriding env variables even if it is disabled (meaning not enabled in the project configuration). And PATH property still fully changed. I suggest to merge PATH property instead of overriding it (split both PATH's to elements and merge into Set)

          Artyom Melnikov added a comment - There is still an issue with plugin overriding env variables even if it is disabled (meaning not enabled in the project configuration). And PATH property still fully changed. I suggest to merge PATH property instead of overriding it (split both PATH's to elements and merge into Set)

          Oleg Nenashev added a comment -

          > I suggest to merge PATH property instead of overriding it (split both PATH's to elements and merge into Set)

          I will be happy to review a pull request for that.
          It's not that trivial in the code though

          Oleg Nenashev added a comment - > I suggest to merge PATH property instead of overriding it (split both PATH's to elements and merge into Set) I will be happy to review a pull request for that. It's not that trivial in the code though

            oleg_nenashev Oleg Nenashev
            olivergondza Oliver Gondža
            Votes:
            47 Vote for this issue
            Watchers:
            66 Start watching this issue

              Created:
              Updated:
              Resolved: