When building using the Branch Source plugin setting so that PR's are discovered as merged with master the commit hash put in the env GIT_COMMIT is not a correct value.

       
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Declarative: Checkout SCM)
      [Pipeline] checkout
      Fetching changes from the remote Git repository
      Cleaning workspace
      Fetching without tags
      Merging remotes/origin/master commit 327f14dfdcdf41c01089767ae1ee35409df56d0e into PR head commit b03e30ec40954b8b40ca85374e4cf1d8eb3511cb
      Merge succeeded, producing 7461047c83a98c6ded075bba1bc44f2386d526d6
      Checking out Revision 7461047c83a98c6ded075bba1bc44f2386d526d6 (PR-12)
      {{ > git rev-parse --is-inside-work-tree # timeout=10}}
      {{ > git config remote.origin.url ... # timeout=10}}
      {{ > git rev-parse --verify HEAD # timeout=10}}
      Resetting working tree
      {{ > git reset --hard # timeout=10}}
      {{ > git clean -fdx # timeout=10}}
      Fetching upstream changes from ...
      {{ > git --version # timeout=10}}
      using GIT_SSH to set credentials CI användare i GitHub
      {{ > git fetch --no-tags --progress ... +refs/pull/12/head:refs/remotes/origin/PR-12 +refs/heads/master:refs/remotes/origin/master}}
      {{ > git config core.sparsecheckout # timeout=10}}
      {{ > git checkout -f b03e30ec40954b8b40ca85374e4cf1d8eb3511cb}}
      {{ > git merge 327f14dfdcdf41c01089767ae1ee35409df56d0e # timeout=10}}
      {{ > git rev-parse HEAD^

      {commit}

      # timeout=10}}
      {{ > git config core.sparsecheckout # timeout=10}}
      {{ > git checkout -f 7461047c83a98c6ded075bba1bc44f2386d526d6}}
      Commit message: "Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD"
      First time build. Skipping changelog.
      Cleaning workspace

      ...

      (later when I print $GIT_COMMIT in an sh step)
      GIT_COMMIT=26053fb12db6deb1f9b129b3d6dbeae505cbae39

      ...

      (to provide som debug info I issue some git command in the same sh step
      latest commit seams ok, since its the result of Jenkins merge locally in the workspace)
      08:42:44 + git log -10
      08:42:44 commit 7461047c83a98c6ded075bba1bc44f2386d526d6
      08:42:44 Merge: b03e30e 327f14d
      08:42:44 Author: Jenkins <nobody@nowhere>
      08:42:44 Date: Tue Jan 15 08:42:40 2019 +0100
      {{08:42:44 }}
      08:42:44 Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD
      08:42:44

      ...

      (git show $GIT_COMMIT fails as the hash do not exist)
      08:42:44 + git show 26053fb12db6deb1f9b129b3d6dbeae505cbae39
      08:42:44 fatal: bad object 26053fb12db6deb1f9b129b3d6dbeae505cbae39 

       

      One maybe related issue is that we are depending on an shared library and I see that there has been changes to the behavior around shared libraries.

      This worked on:

      Git Plugin 3.8.0
      Branch Source Plugin 2.3.3
      Jenkins 2.138.3

       

          [JENKINS-55592] GIT_COMMIT contains unknown value

          Jonas Hoglin created issue -
          Jonas Hoglin made changes -
          Description Original: When building using the Branch Source plugin setting so that PR's are discovered as merged with master the commit hash put in the env GIT_COMMIT is not a correct value.

           
          Pipeline] {[Pipeline] stage[Pipeline] { (Declarative: Checkout SCM)[Pipeline] checkoutFetching changes from the remote Git repository
          Cleaning workspace
          Fetching without tags
          Merging remotes/origin/master commit 327f14dfdcdf41c01089767ae1ee35409df56d0e into PR head commit b03e30ec40954b8b40ca85374e4cf1d8eb3511cb
          Merge succeeded, producing *7461047c83a98c6ded075bba1bc44f2386d526d6*Checking out Revision *7461047c83a98c6ded075bba1bc44f2386d526d6* (PR-12) > git rev-parse --is-inside-work-tree # timeout=10
           > git config remote.origin.url ... # timeout=10
           > git rev-parse --verify HEAD # timeout=10
          Resetting working tree
           > git reset --hard # timeout=10
           > git clean -fdx # timeout=10
          Fetching upstream changes from ...
           > git --version # timeout=10
          using GIT_SSH to set credentials ...
           > git fetch --no-tags --progress ... +refs/pull/12/head:refs/remotes/origin/PR-12 +refs/heads/master:refs/remotes/origin/master
           > git config core.sparsecheckout # timeout=10
           > git checkout -f b03e30ec40954b8b40ca85374e4cf1d8eb3511cb
           > git merge 327f14dfdcdf41c01089767ae1ee35409df56d0e # timeout=10
           > git rev-parse HEAD^\{commit} # timeout=10
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 7461047c83a98c6ded075bba1bc44f2386d526d6
          Commit message: "Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD"
          First time build. Skipping changelog.
          Cleaning workspace

          ...

          (later when I print $GIT_COMMIT in an sh step)
          GIT_COMMIT=26053fb12db6deb1f9b129b3d6dbeae505cbae39

          ...
          (to provide som debug info I issue some git command in the same sh step
          latest commit seams ok, since its the result of Jenkins merge locally in the workspace)
          08:42:44 + git log -10
          08:42:44 commit 7461047c83a98c6ded075bba1bc44f2386d526d6
          08:42:44 Merge: b03e30e 327f14d
          08:42:44 Author: Jenkins <nobody@nowhere>
          08:42:44 Date: Tue Jan 15 08:42:40 2019 +0100
          08:42:44
          08:42:44 Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD
          08:42:44

          ...
          (git show $GIT_COMMIT fails as the hash do not exist)
          08:42:44 + git show 26053fb12db6deb1f9b129b3d6dbeae505cbae39
          08:42:44 fatal: bad object 26053fb12db6deb1f9b129b3d6dbeae505cbae39



           

          One mayby related issue is that we are depending on an shared libary and I see that there has been changes to the behaviour around shared libraries.

          This worked on:

          Git Plugin 3.8.0
          Branch Source Plugin 2.3.3
          Jenkins 2.138.3


           
          New: When building using the Branch Source plugin setting so that PR's are discovered as merged with master the commit hash put in the env GIT_COMMIT is not a correct value.

          {{ }}
          {{}}

          {{[Pipeline] {}}
          {{[Pipeline] stage}}
          {{[Pipeline] { (Declarative: Checkout SCM)}}
          {{[Pipeline] checkout}}
          {{Fetching changes from the remote Git repository}}
          {{Cleaning workspace}}
          {{Fetching without tags}}
          {{Merging remotes/origin/master commit 327f14dfdcdf41c01089767ae1ee35409df56d0e into PR head commit b03e30ec40954b8b40ca85374e4cf1d8eb3511cb}}
          {{Merge succeeded, producing 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{Checking out Revision 7461047c83a98c6ded075bba1bc44f2386d526d6 (PR-12)}}
          {{ > git rev-parse --is-inside-work-tree # timeout=10}}
          {{ > git config remote.origin.url git@git.rsv.se:SKV/fa-hot-deklarera-web.git # timeout=10}}
          {{ > git rev-parse --verify HEAD # timeout=10}}
          {{Resetting working tree}}
          {{ > git reset --hard # timeout=10}}
          {{ > git clean -fdx # timeout=10}}
          {{Fetching upstream changes from git@git.rsv.se:SKV/fa-hot-deklarera-web.git}}
          {{ > git --version # timeout=10}}
          {{using GIT_SSH to set credentials CI användare i GitHub}}
          {{ > git fetch --no-tags --progress git@git.rsv.se:SKV/fa-hot-deklarera-web.git +refs/pull/12/head:refs/remotes/origin/PR-12 +refs/heads/master:refs/remotes/origin/master}}
          {{ > git config core.sparsecheckout # timeout=10}}
          {{ > git checkout -f b03e30ec40954b8b40ca85374e4cf1d8eb3511cb}}
          {{ > git merge 327f14dfdcdf41c01089767ae1ee35409df56d0e # timeout=10}}
          {{ > git rev-parse HEAD^\{commit} # timeout=10}}
          {{ > git config core.sparsecheckout # timeout=10}}
          {{ > git checkout -f 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{Commit message: "Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD"}}
          {{First time build. Skipping changelog.}}
          {{Cleaning workspace}}

          {{...}}

          {{(later when I print $GIT_COMMIT in an sh step)}}
          {{GIT_COMMIT=26053fb12db6deb1f9b129b3d6dbeae505cbae39}}

          {{...}}

          {{(to provide som debug info I issue some git command in the same sh step}}
          {{latest commit seams ok, since its the result of Jenkins merge locally in the workspace)}}
          {{08:42:44 + git log -10}}
          {{08:42:44 commit 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{08:42:44 Merge: b03e30e 327f14d}}
          {{08:42:44 Author: Jenkins <nobody@nowhere>}}
          {{08:42:44 Date: Tue Jan 15 08:42:40 2019 +0100}}
          {{08:42:44 }}
          {{08:42:44 Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD}}
          {{08:42:44}}

          {{...}}

          {{(git show $GIT_COMMIT fails as the hash do not exist)}}
          {{08:42:44 + git show 26053fb12db6deb1f9b129b3d6dbeae505cbae39}}
          {{08:42:44 fatal: bad object 26053fb12db6deb1f9b129b3d6dbeae505cbae39 }}

          {{ }}

          One maybe related issue is that we are depending on an shared library and I see that there has been changes to the behavior around shared libraries.

          This worked on:

          Git Plugin 3.8.0
           Branch Source Plugin 2.3.3
           Jenkins 2.138.3

           
          Jonas Hoglin made changes -
          Description Original: When building using the Branch Source plugin setting so that PR's are discovered as merged with master the commit hash put in the env GIT_COMMIT is not a correct value.

          {{ }}
          {{}}

          {{[Pipeline] {}}
          {{[Pipeline] stage}}
          {{[Pipeline] { (Declarative: Checkout SCM)}}
          {{[Pipeline] checkout}}
          {{Fetching changes from the remote Git repository}}
          {{Cleaning workspace}}
          {{Fetching without tags}}
          {{Merging remotes/origin/master commit 327f14dfdcdf41c01089767ae1ee35409df56d0e into PR head commit b03e30ec40954b8b40ca85374e4cf1d8eb3511cb}}
          {{Merge succeeded, producing 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{Checking out Revision 7461047c83a98c6ded075bba1bc44f2386d526d6 (PR-12)}}
          {{ > git rev-parse --is-inside-work-tree # timeout=10}}
          {{ > git config remote.origin.url git@git.rsv.se:SKV/fa-hot-deklarera-web.git # timeout=10}}
          {{ > git rev-parse --verify HEAD # timeout=10}}
          {{Resetting working tree}}
          {{ > git reset --hard # timeout=10}}
          {{ > git clean -fdx # timeout=10}}
          {{Fetching upstream changes from git@git.rsv.se:SKV/fa-hot-deklarera-web.git}}
          {{ > git --version # timeout=10}}
          {{using GIT_SSH to set credentials CI användare i GitHub}}
          {{ > git fetch --no-tags --progress git@git.rsv.se:SKV/fa-hot-deklarera-web.git +refs/pull/12/head:refs/remotes/origin/PR-12 +refs/heads/master:refs/remotes/origin/master}}
          {{ > git config core.sparsecheckout # timeout=10}}
          {{ > git checkout -f b03e30ec40954b8b40ca85374e4cf1d8eb3511cb}}
          {{ > git merge 327f14dfdcdf41c01089767ae1ee35409df56d0e # timeout=10}}
          {{ > git rev-parse HEAD^\{commit} # timeout=10}}
          {{ > git config core.sparsecheckout # timeout=10}}
          {{ > git checkout -f 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{Commit message: "Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD"}}
          {{First time build. Skipping changelog.}}
          {{Cleaning workspace}}

          {{...}}

          {{(later when I print $GIT_COMMIT in an sh step)}}
          {{GIT_COMMIT=26053fb12db6deb1f9b129b3d6dbeae505cbae39}}

          {{...}}

          {{(to provide som debug info I issue some git command in the same sh step}}
          {{latest commit seams ok, since its the result of Jenkins merge locally in the workspace)}}
          {{08:42:44 + git log -10}}
          {{08:42:44 commit 7461047c83a98c6ded075bba1bc44f2386d526d6}}
          {{08:42:44 Merge: b03e30e 327f14d}}
          {{08:42:44 Author: Jenkins <nobody@nowhere>}}
          {{08:42:44 Date: Tue Jan 15 08:42:40 2019 +0100}}
          {{08:42:44 }}
          {{08:42:44 Merge commit '327f14dfdcdf41c01089767ae1ee35409df56d0e' into HEAD}}
          {{08:42:44}}

          {{...}}

          {{(git show $GIT_COMMIT fails as the hash do not exist)}}
          {{08:42:44 + git show 26053fb12db6deb1f9b129b3d6dbeae505cbae39}}
          {{08:42:44 fatal: bad object 26053fb12db6deb1f9b129b3d6dbeae505cbae39 }}

          {{ }}

          One maybe related issue is that we are depending on an shared library and I see that there has been changes to the behavior around shared libraries.

          This worked on:

          Git Plugin 3.8.0
           Branch Source Plugin 2.3.3
           Jenkins 2.138.3

           
          New: When building using the Branch Source plugin setting so that PR's are discovered as merged with master the commit hash put in the env GIT_COMMIT is not a correct value.

          {{ }}
          {{[Pipeline] {}}
           {{[Pipeline] stage}}
           {{[Pipeline] { (Declarative: Checkout SCM)}}
           {{[Pipeline] checkout}}
           {{Fetching changes from the remote Git repository}}
           {{Cleaning workspace}}
           {{Fetching without tags}}
           {{Merging remotes/origin/master commit {color:#0747a6}327f14dfdcdf41c01089767ae1ee35409df56d0e{color} into PR head commit {color:#4c9aff}b03e30ec40954b8b40ca85374e4cf1d8eb3511cb{color}}}
           {{Merge succeeded, producing {color:#00875a}7461047c83a98c6ded075bba1bc44f2386d526d6{color}}}
           {{Checking out Revision {color:#00875a}7461047c83a98c6ded075bba1bc44f2386d526d6 {color}(PR-12)}}
           \{{ > git rev-parse --is-inside-work-tree # timeout=10}}
           \{{ > git config remote.origin.url ... # timeout=10}}
           \{{ > git rev-parse --verify HEAD # timeout=10}}
           {{Resetting working tree}}
           \{{ > git reset --hard # timeout=10}}
           \{{ > git clean -fdx # timeout=10}}
           {{Fetching upstream changes from ...}}
           \{{ > git --version # timeout=10}}
           {{using GIT_SSH to set credentials CI användare i GitHub}}
           \{{ > git fetch --no-tags --progress ... +refs/pull/12/head:refs/remotes/origin/PR-12 +refs/heads/master:refs/remotes/origin/master}}
           \{{ > git config core.sparsecheckout # timeout=10}}
           {{ > git checkout -f {color:#4c9aff}b03e30ec40954b8b40ca85374e4cf1d8eb3511cb{color}}}
           {{ > git merge {color:#0747a6}327f14dfdcdf41c01089767ae1ee35409df56d0e{color} # timeout=10}}
           \{{ > git rev-parse HEAD^{commit} # timeout=10}}
           \{{ > git config core.sparsecheckout # timeout=10}}
           {{ > git checkout -f {color:#00875a}7461047c83a98c6ded075bba1bc44f2386d526d6{color}}}
           {{Commit message: "Merge commit '{color:#0747a6}327f14dfdcdf41c01089767ae1ee35409df56d0e{color}' into HEAD"}}
           {{First time build. Skipping changelog.}}
           {{Cleaning workspace}}

          {{...}}

          {{(later when I print $GIT_COMMIT in an sh step)}}
           {{GIT_COMMIT={color:#de350b}+_26053fb12db6deb1f9b129b3d6dbeae505cbae39_+{color}}}

          {{...}}

          {{(to provide som debug info I issue some git command in the same sh step}}
           {{latest commit seams ok, since its the result of Jenkins merge locally in the workspace)}}
           {{08:42:44 + git log -10}}
           {{08:42:44 commit {color:#00875a}7461047c83a98c6ded075bba1bc44f2386d526d6{color}}}
           {{08:42:44 Merge: {color:#4c9aff}b03e30e{color} {color:#0747a6}327f14d{color}}}
           {{08:42:44 Author: Jenkins <nobody@nowhere>}}
           {{08:42:44 Date: Tue Jan 15 08:42:40 2019 +0100}}
           \{{08:42:44 }}
           {{08:42:44 Merge commit '{color:#0747a6}327f14dfdcdf41c01089767ae1ee35409df56d0e{color}' into HEAD}}
           {{08:42:44}}

          {{...}}

          {{(git show $GIT_COMMIT fails as the hash do not exist)}}
           {{08:42:44 + git show {color:#de350b}26053fb12db6deb1f9b129b3d6dbeae505cbae39{color}}}
           {{08:42:44 fatal: bad object {color:#de350b}26053fb12db6deb1f9b129b3d6dbeae505cbae39 {color}}}

          {{ }}

          One maybe related issue is that we are depending on an shared library and I see that there has been changes to the behavior around shared libraries.

          This worked on:

          Git Plugin 3.8.0
           Branch Source Plugin 2.3.3
           Jenkins 2.138.3

           
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Jonas Hoglin made changes -
          Priority Original: Major [ 3 ] New: Minor [ 4 ]
          Mark Waite made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Mark Waite made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            Unassigned Unassigned
            jhoglin Jonas Hoglin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: