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

Content of BUILD_ID environment variable changed from timestamp to build number

      With ticket JENKINS-24380, the BUILD_ID was changed from timestamp to the build number in version 1.597:

      Stop using the formatted timestamp to compute Run.id, and just use the build number as the directory name, so that

      This change affected the content of the environment variable BUILD_ID too, becoming equal to the content of BUILD_NUMBER. I used the BUILD_ID variable in my jobs to detect the time, the current build was started. Now I can not do this anymore. Please consider to introduce another variable that will transport the earlier content of BUILD_ID. E.g. create a new environment variable called "BUILD_TIMESTAMP".
      So long, I use the EnvInject plugin together with this Groovy script as a workaround:

      return [BUILD_TIMESTAMP:currentBuild.getTime().format("yyyy-MM-dd_HH-mm-ss")]

      The change makes it also necessary to fix the content of the "env-vars.html" file (help link below a Windows Batch Command entry). Description of BUILD_ID must be changed and BUILD_TIMESTAMP must be added.

      The zentimestamp plugin will become invalid after this change. It must be changed to affect the content of the variable BUILD_TIMESTAMP variable.

          [JENKINS-26624] Content of BUILD_ID environment variable changed from timestamp to build number

          Michael Rentschler created issue -
          Michael Rentschler made changes -
          Description Original: Stop using the formatted {{timestamp}} to compute {{Run.id}}, and just use the build number as the directory name, so that

          {code}r.getId().equals(String.valueOf(r.number)){code}

          in which case the {{timestamp}} would have to be made a nontransient field (but {{number}} could be transient). Then build number symlinks could be dispensed with, saving some hassle and overhead; and {{AbstractLazyLoadRunMap}} could be greatly simplified, since the disk location would be immediately predictable from the number, which is what most API calls care about.

          The downside is that there would have to be a one-time migration, which could be slow on a big installation, and not reversible.
          New: With ticket JENKINS-24380, the BUILD_ID was changed from timestamp to the build number in version 1.597:
          {quote}
          Stop using the formatted {{timestamp}} to compute {{Run.id}}, and just use the build number as the directory name, so that
          {quote}

          This change affected the content of the environment variable {{BUILD_ID}} too, becoming equal to the content of {{BUILD_NUMBER}}. I used the {{BUILD_ID}} variable in my jobs to detect the time, the current build was started. Now I can not do this anymore. Please consider to introduce another variable that will transport the earlier content of {{BUILD_ID}}. E.g. create a new environment variable called "BUILD_TIMESTAMP".
          So long, I use the EnvInject plugin together with this Groovy script as a workaround:

          {quote}
          return [BUILD_TIMESTAMP:currentBuild.getTime().format("yyyy-MM-dd_HH-mm-ss")]
          {quote}

          The change makes it also necessary to fix the content of the "env-vars.html" file (help link below a Windows Batch Command entry). Description of {{BUILD_ID}} must be changed and {{BUILD_TIMESTAMP}} must be added.

          The {{zentimestamp}} plugin will become invalid after this change. It must be changed to affect the content of the variable {{BUILD_TIMESTAMP}} variable.
          Issue Type Original: Task [ 3 ] New: Bug [ 1 ]
          Michael Rentschler made changes -
          Summary Original: Use build numbers as IDs - Follow up New: Content of BUILD_ID environment variable changed content to build number
          Michael Rentschler made changes -
          Summary Original: Content of BUILD_ID environment variable changed content to build number New: Content of BUILD_ID environment variable changed from timestamp to build number
          Michael Rentschler made changes -
          Link New: This issue is related to JENKINS-24380 [ JENKINS-24380 ]
          Michael Rentschler made changes -
          Link New: This issue is related to JENKINS-26626 [ JENKINS-26626 ]
          Daniel Beck made changes -
          Assignee Original: Jesse Glick [ jglick ]
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Beck made changes -
          Link New: This issue duplicates JENKINS-26520 [ JENKINS-26520 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 160697 ] New: JNJira + In-Review [ 196532 ]

            Unassigned Unassigned
            mre_mchp Michael Rentschler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: