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

Expose full name of parent job as an environment variable

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      In an environment using folders the PROMOTED_JOB_NAME cannot be relied upon to differentiate two different jobs. Ideally the full name of the build being promoted would be exposed as PROMOTED_JOB_FULL_NAME.

      The quick and dirty is rather simple: when building the environment variables set PROMOTED_JOB_FULL_NAME to target.getParent().getFullName().

        Attachments

          Activity

          Hide
          tyrius Jonathan Zimmerman added a comment -
          Show
          tyrius Jonathan Zimmerman added a comment - I've added logic and a UT for this. https://github.com/jenkinsci/promoted-builds-plugin/pull/29
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: jzimmerman
          Path:
          src/main/java/hudson/plugins/promoted_builds/Promotion.java
          src/test/java/hudson/plugins/promoted_builds/PromotionEnvironmentVariablesTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/d59506de31e88bed5d34ff0794acb86ec68e9645
          Log:
          [FIXED JENKINS-18958] Added PROMOTED_JOB_FULL_NAME

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: jzimmerman Path: src/main/java/hudson/plugins/promoted_builds/Promotion.java src/test/java/hudson/plugins/promoted_builds/PromotionEnvironmentVariablesTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/d59506de31e88bed5d34ff0794acb86ec68e9645 Log: [FIXED JENKINS-18958] Added PROMOTED_JOB_FULL_NAME
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/hudson/plugins/promoted_builds/Promotion.java
          src/test/java/hudson/plugins/promoted_builds/PromotionEnvironmentVariablesTest.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/c88acb15fb5d6e8fc40fca21bc92c243cb21409e
          Log:
          Merge pull request #29 from tyrius02/master

          [FIXED JENKINS-18958] Added PROMOTED_JOB_FULL_NAME environment variable

          Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/312c4c582734...c88acb15fb5d

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/hudson/plugins/promoted_builds/Promotion.java src/test/java/hudson/plugins/promoted_builds/PromotionEnvironmentVariablesTest.java http://jenkins-ci.org/commit/promoted-builds-plugin/c88acb15fb5d6e8fc40fca21bc92c243cb21409e Log: Merge pull request #29 from tyrius02/master [FIXED JENKINS-18958] Added PROMOTED_JOB_FULL_NAME environment variable Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/312c4c582734...c88acb15fb5d
          Hide
          josht Joshua Tharp added a comment -

          This behavior has apparently regressed.
          Promoted Builds Plugin: 2.27
          Jenkins: 1.653

          From a job promotion I echoed out the JOB_NAME and PROMOTED_JOB_NAME variables:
          echo ${JOB_NAME}
          ParentFolder/ChildFolder/Project/promotion/PromotionJob

          echo ${PROMOTED_JOB_NAME}
          Project

          I expected PROMOTED_JOB_NAME to have the value "ParentFolder/ChildFolder/Project".

          Show
          josht Joshua Tharp added a comment - This behavior has apparently regressed. Promoted Builds Plugin: 2.27 Jenkins: 1.653 From a job promotion I echoed out the JOB_NAME and PROMOTED_JOB_NAME variables: echo ${JOB_NAME} ParentFolder/ChildFolder/Project/promotion/PromotionJob echo ${PROMOTED_JOB_NAME} Project I expected PROMOTED_JOB_NAME to have the value "ParentFolder/ChildFolder/Project".

            People

            • Assignee:
              Unassigned
              Reporter:
              tyrius Jonathan Zimmerman
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: