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

env.GIT_COMMIT is overwritten when pull lib (lib and code in the same repo), can not get the right GIT_COMMIT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      env.GIT_COMMIT is overwritten when pull lib (lib and code in the same repo)

       

      SharedLibrary put in the same code repo, different branch named xxx_lib, and after Declarative: Checkout SCM, can not get the right GIT_COMMIT, always be the xxx_lib's last commit, not the code's commit

       

       

      I create example repo to this issue: https://github.com/bonfy/JENKINS-61317

      Jenkinsfile in master branch Last commit: 39f25e1a
      library in jenkins-lib branch Last commit: a8c235b1

      and when echo GIT_COMMIT, it is overwitten by lib's commit

      16:55:47 stage 1
      [Pipeline] echo
      16:55:47 GIT COMMIT : a8c235b10c55e2f065293b1c1ad9b3bffd45d9d9
      [Pipeline] echo
      16:55:47 GIT BRANCH : jenkins-lib
      [Pipeline] echo
      16:55:48 Hello world

       

            Unassigned Unassigned
            bonfy bon ch
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: