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

BUILD_DISPLAY_NAME environment variable not updated

    XMLWordPrintable

Details

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

    Description

      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).

      Attachments

        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

        Issue Links

          Activity

            hqzhang HAIQING ZHANG added a comment -

            le0 could you please fix this issue?

            hqzhang HAIQING ZHANG added a comment - le0 could you please fix this issue?
            noama Noam Angel added a comment -

            issue not fixed on plugin 1.6.5

            noama Noam Angel added a comment - issue not fixed on plugin 1.6.5
            jlevis 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.

            jlevis 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.
            darrenmoss 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.

            darrenmoss 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.
            jlevis 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:

            jlevis 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:

            People

              le0 Lev Mishin
              stammt Timo Stamm
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: