-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
-
git plugin 4.7.0 released 17 Mar 2021
This looks like the same type of code-path issue described in https://issues.jenkins-ci.org/browse/JENKINS-41996
@Library('someGitLibrary') node { final scmVars = checkout(scm) // scmVars may have Git data from either the someGitLibrary or the scmVars }
Looks like its caused by https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L1282-L1317
- duplicates
-
JENKINS-53346 GitSCM checkout returns same values on second different call
-
- Closed
-
- is blocked by
-
JENKINS-52378 Revision state returned by Git SCM step is incorrect
-
- Closed
-
[JENKINS-45489] checkout(scm) step can return wrong variables when used following another Git checkout
Description |
Original:
This looks like the same type of code-path issue described in https://issues.jenkins-ci.org/browse/JENKINS-41996  {code:java} @Library('someGitLibrary') node { final scmVars = checkout(scm) // scmVars may have Git data from either the }{code} Looks like its caused by [https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L1282-L1317] |
New:
This looks like the same type of code-path issue described in https://issues.jenkins-ci.org/browse/JENKINS-41996  {code:java} @Library('someGitLibrary') node { final scmVars = checkout(scm) // scmVars may have Git data from either the someGitLibrary or the scmVars }{code} Looks like its caused by [https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L1282-L1317] |
Component/s | New: scm-api-plugin [ 18054 ] | |
Component/s | Original: git-plugin [ 15543 ] |
Assignee | Original: Mark Waite [ markewaite ] |
Summary | Original: checkout(scm) step can return wrong variables when used with a global library that is pulled from Git | New: checkout(scm) step can return wrong variables when used following another Git checkout |
Thanks for the bug report. I think that I've started to duplicate the bug conditions in the JENKINS-45489 job in my jenkins-bugs repository. At a minimum, I'm seeing surprising results where the return from the checkout() task includes a GIT_COMMITER_NAME which seems to come from the library, while the GIT_COMMIT seems to come from the commit in the intended repository. I haven't yet duplicated the precise result you're describing, but I'm exploring on that branch to understand the problem better.
The GIT_COMMIT values match what I expected (taken from the checkout, not from the library), while the values of the author and committer related variables seem to come from the library. Specifically, I see the following values that seem correct:
and the following values seem incorrect:
Do those results match with what you're seeing?