Promotion is an independent job type, which has its own environment. Several promotion-oriented build steps may need an environment or artifacts of the original builds, so they may call the TokenMacro resolution against the build.

      In particular cases we're interested to support environment variables from both Promotion and original build. In such case it would be great to have a PROMOTION_ENV macro, which finds the source promotion job by the current executor context. In such case ENV and PROMOTION_ENV macros will allow to extract variables from both jobs.

          [JENKINS-30411] Add the PROMOTION_ENV token macro

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          pom.xml
          src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java
          src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly
          src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/3c38412146343a41909ff15cbfc1f91efb0c6a31
          Log:
          [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro

          Promotion is an independent job type, which has its own environment. Several promotion-oriented build steps may need an environment or artifacts of the original builds, so they may call the TokenMacro resolution against the build.

          In particular cases we're interested to support environment variables from both Promotion and original build. In such case it would be great to have a PROMOTION_ENV macro, which finds the source promotion job by the current executor context. In such case ENV and PROMOTION_ENV macros will allow to extract variables from both jobs.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/3c38412146343a41909ff15cbfc1f91efb0c6a31 Log: [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro Promotion is an independent job type, which has its own environment. Several promotion-oriented build steps may need an environment or artifacts of the original builds, so they may call the TokenMacro resolution against the build. In particular cases we're interested to support environment variables from both Promotion and original build. In such case it would be great to have a PROMOTION_ENV macro, which finds the source promotion job by the current executor context. In such case ENV and PROMOTION_ENV macros will allow to extract variables from both jobs.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          pom.xml
          src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java
          src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly
          src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/71dd42048d54d9984bbf6a1710d6f99729659452
          Log:
          [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/71dd42048d54d9984bbf6a1710d6f99729659452 Log: [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          pom.xml
          src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java
          src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly
          src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/59fa76a11661d2aa9c1be1f283505ada87661b69
          Log:
          Merge pull request #67 from jenkinsci/JENKINS-30411

          [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro

          Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/2a2ea4d0be78...59fa76a11661

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: pom.xml src/main/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacro.java src/main/resources/hudson/plugins/promoted_builds/tokenmacro/help.jelly src/test/java/hudson/plugins/promoted_builds/tokenmacro/PromotedEnvVarTokenMacroTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/59fa76a11661d2aa9c1be1f283505ada87661b69 Log: Merge pull request #67 from jenkinsci/ JENKINS-30411 [FIXED JENKINS-30411] - Add the PROMOTION_ENV token macro Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/2a2ea4d0be78...59fa76a11661

          Is it expected that PROMOTION_ENV should be able to retrieve env vars added or changed by the env_inject plugin?

          Michael Fowler added a comment - Is it expected that PROMOTION_ENV should be able to retrieve env vars added or changed by the env_inject plugin?

          Oleg Nenashev added a comment -

          It should.

          Oleg Nenashev added a comment - It should.

          oleg_nenashev Thanks. It's only working for the variables set prior to the jobs run for me. Should I open a separate ticket?

          Michael Fowler added a comment - oleg_nenashev Thanks. It's only working for the variables set prior to the jobs run for me. Should I open a separate ticket?

            oleg_nenashev Oleg Nenashev
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: