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

BUILD_DISPLAY_NAME environment variable not updated

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Windows Server 2012R2 64Bit,
      Jenkins v1.646 (ran directly),
      build-name-setter v1.5.1

      The build display name appears correctly in Jenkins (see 1.jpg and 2.jpg).
      However we've noticed that some plugins do not use the correct value. In our case we noticed it with the email-ext plugin where the BUILD_DISPLAY_NAME variable was replaced with the standard BUILD_NUMBER.
      When looking at the environment variables from that build, it is also not updated (as displayed in 3.jpg).

      As far as I can tell the email-ext plugin relies on this environment variable (as may others). But it does not get updated as I would expect by the build-name-setter plugin.

      This occured in freestyle jobs as well as in multibranch projects (through the multibranch plugin).

        1. 1.jpg
          1.jpg
          63 kB
        2. 2.jpg
          2.jpg
          181 kB
        3. 3.jpg
          3.jpg
          252 kB
        4. build_name_setter.PNG
          build_name_setter.PNG
          8 kB

          [JENKINS-33687] BUILD_DISPLAY_NAME environment variable not updated

          Lev Mishin added a comment -

          Fixed in version 1.6.5

          Lev Mishin added a comment - Fixed in version 1.6.5

          Ruben Diaz added a comment -

          This is happening as of today with Jenkins 2.7.4.

          Ruben Diaz added a comment - This is happening as of today with Jenkins 2.7.4.

          Attachment "3.jpg" looks very good. Can someone let me know, what Plugin is used to Display the Environment variables and values used in a particular Build?

          Raghavendra Tallam added a comment - Attachment "3.jpg" looks very good. Can someone let me know, what Plugin is used to Display the Environment variables and values used in a particular Build?

          Anja Döbele added a comment -

          Is it planned to resolve this issue with the next update?

          Anja Döbele added a comment - Is it planned to resolve this issue with the next update?

          HAIQING ZHANG added a comment -

          le0 could you please fix this issue?

          HAIQING ZHANG added a comment - le0 could you please fix this issue?

          Noam Angel added a comment -

          issue not fixed on plugin 1.6.5

          Noam Angel added a comment - issue not fixed on plugin 1.6.5

          Joe Levis added a comment -

          I can confirm this is not working with build-name-setter 1.6.5.

          BUILD_DISPLAY_NAME is still set to build number instead of what I've specified in the job configuration.

          Joe Levis added a comment - I can confirm this is not working with build-name-setter 1.6.5. BUILD_DISPLAY_NAME is still set to build number instead of what I've specified in the job configuration.

          Darren Moss added a comment - - edited

          I had a similar problem.

          But I knew it was working for the nexus repository upload.

          It was not working when I passed ${BUILD_DISPLAY_NAME} to a shell executed script. All I saw was #63 (or whatever build number I was on)

          RESOLVED:

          I resolved it when i moved the "Update Build Name" to before the "Execute Shell".

          The name was not built by the time I executed the shell script but it was ready before the nexus upload.

          I made sure the name was ready first and then the correct name was ready for both the script and the nexus upload.

          Darren Moss added a comment - - edited I had a similar problem. But I knew it was working for the nexus repository upload. It was not working when I passed ${BUILD_DISPLAY_NAME} to a shell executed script. All I saw was #63 (or whatever build number I was on) RESOLVED: I resolved it when i moved the "Update Build Name" to before the "Execute Shell". The name was not built by the time I executed the shell script but it was ready before the nexus upload. I made sure the name was ready first and then the correct name was ready for both the script and the nexus upload.

          Joe Levis added a comment -

          darrenmoss,

          Thanks for the info! I wasn't aware of the "Update Build Name" option in the BUILD tasks. Although, this didn't update the BUILD_DISPLAY_NAME variable when Iook at "Environment Variables" after the build completes - and that's really the issue, as far as I understand.

          Also, I find it strange that an extra build step like "update build name" would even be necessary, since we're already specifying to "Set Build Name before build starts" in the Build Environment section:

          Joe Levis added a comment - darrenmoss , Thanks for the info! I wasn't aware of the "Update Build Name" option in the BUILD tasks. Although, this didn't update the BUILD_DISPLAY_NAME variable when Iook at "Environment Variables" after the build completes - and that's really the issue, as far as I understand. Also, I find it strange that an extra build step like "update build name" would even be necessary, since we're already specifying to "Set Build Name before build starts" in the Build Environment section:

            le0 Lev Mishin
            stammt Timo Stamm
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: