-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins 2.16
Windows Server 2012 R2
-
-
git plugin 4.4.3
Description of the problem
I've a multibranch pipeline project configured with the local branch extension and many branch following the git flow model (features/xxxx). When I push a commit on the feature branch, this commit is detected by Jenkins, and pulled by the master to read the Jenkinsfile. The first time it works, but after that, the local branch is selected instead of the remote branch, amd the new commits are not fetch. The bug only occurs on branches with a slash in their names.
Investigation
I've connected my debugger to my Jenkins installation.
It appears that Jenkins has detected 2 branches matching the name. One local and one remote. The local one is created by the local branch git extension.
I can't explicitly specify to Jenkins to use the remote one because I use the pipeline plugin, and this checkout is made automatically to retrieve the Jenkinsfile. So, the git implementation takes the first one, which is generally the local branch which is not yet updated...
Revision marked = candidates.iterator().next();
Logs
16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30
How to fix it
Possibilities I see :
- Update the workflow-multibranch-plugin / branch-api-plugin to checkout on origin (prefix with refs/remotes/origin/)
- Update the git-plugin to order the list, and prioritize remote branches
Personally, I think the first one is safer, but I've not yet played with this plugin.
Here is my proposition on Github: https://github.com/jenkinsci/branch-api-plugin/pull/47
How to reproduce
- Create a new repository and initialize it (on github, with a README.md for example)
- Clone it on your computer:
git clone https://lausivoiduts.visualstudio.com/QuarahMC/_git/JENKINS-37263 cd JENKINS-37263
- Create a new branch:
git checkout -b features/this-bug
- Add something in the Jenkinsfile:
echo "echo 'first commit' " > Jenkinsfile
- Commit and push it:
git add Jenkinfile git commit -m "first commit" git push --set-upstream origin features/this-bug
- Add a new Multibranch Pipeline Project in Jenkins, add as Source your git repository.
Click on "Add Behaviour", select "Checkout to a local branch".
Set its value to "**" (without the quotes).
Validate it. - Check that the branch was built, and the message "first commit" appears in the log
- Modify your Jenkinsfile:
echo "echo 'second commit' " > Jenkinsfile
- Commit and push it:
git add Jenkinfile git commit -m "second commit" git push
- Run the branch indexing
- Check that the branch is built. Check the log, you'll see "first commit" instead of "second commit".
- is duplicated by
-
JENKINS-50401 Checkout resolution misbehaves with local branch and forward slashes
-
- Open
-
[JENKINS-37263] Jenkins checkout the wrong commit when used with the local branch behaviour on a branch with a / (slash)
Description |
Original:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. |
New:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. |
Description |
Original:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. |
New:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. It seems to be linked with merges. |
Description |
Original:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. It seems to be linked with merges. |
New:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. It seems to be linked with merges. After some research, I can't reproduce it yet... I've retried the same build yesterday many times, I had the same error. This morning, after retrying, I don't have the error anymore... I'm using Visual Studio Team Services as Git repository. I will monitor the future builds. |
Summary | Original: "checkout scm" retrieves the wrong commit on the slave | New: checkout to the wrong commit when used with local branch |
Component/s | New: git-plugin [ 15543 ] | |
Component/s | Original: workflow-multibranch-plugin [ 21465 ] |
Labels | Original: git multibranch | New: git |
Description |
Original:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce I've not found yet how to reproduce this behavior but I'm actively investigating it. I'll update this thread as soon as I'll have more information. It seems to be linked with merges. After some research, I can't reproduce it yet... I've retried the same build yesterday many times, I had the same error. This morning, after retrying, I don't have the error anymore... I'm using Visual Studio Team Services as Git repository. I will monitor the future builds. |
New:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce -- Not yet found a way to easily reproduce it -- |
Attachment | New: jenkins-local-branch-bug-1.PNG [ 33579 ] |
Description |
Original:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Jenkinsfile {code:java} node('build') { checkout scm } {code} h2. Logs {noformat} Started by user anonymous Setting origin to https://my-server.com/repo.git Fetching origin... > git.exe rev-parse --is-inside-work-tree # timeout=30 Fetching changes from the remote Git repository > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 Cleaning workspace > git.exe rev-parse --verify HEAD # timeout=30 Resetting working tree > git.exe reset --hard # timeout=30 > git.exe clean -fdx # timeout=30 Fetching upstream changes from https://my-server.com/repo.git > git.exe --version # timeout=30 using .gitcredentials to set credentials > git.exe config --local credential.username MyUsername # timeout=30 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git3518615989109492530.credentials\" # timeout=30 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 > git.exe config --local --remove-section credential # timeout=30 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 Checking out Revision 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d (features/my-feature-branch) > git.exe config core.sparsecheckout # timeout=30 > git.exe checkout -f 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe branch -a -v --no-abbrev # timeout=30 > git.exe branch -D features/my-feature-branch # timeout=30 > git.exe checkout -b features/my-feature-branch 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=120 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 [Pipeline] timestamps [Pipeline] { [Pipeline] stage (Commit) 16:10:21 Entering stage Commit 16:10:21 Proceeding [Pipeline] node 16:10:21 Running on commit02 in D:\agent\workspace\b\076b57f2 [Pipeline] { [Pipeline] ws 16:10:21 Running in D:\agent\build [Pipeline] { [Pipeline] checkout 16:10:27 > git.exe rev-parse --is-inside-work-tree # timeout=30 16:10:28 Fetching changes from the remote Git repository 16:10:28 > git.exe config remote.origin.url https://my-server.com/repo.git # timeout=30 16:10:28 Cleaning workspace 16:10:28 > git.exe rev-parse --verify HEAD # timeout=30 16:10:28 Resetting working tree 16:10:28 > git.exe reset --hard # timeout=30 16:10:28 > git.exe clean -fdx # timeout=30 16:10:28 Fetching upstream changes from https://my-server.com/repo.git 16:10:28 > git.exe --version # timeout=30 16:10:28 using .gitcredentials to set credentials 16:10:28 > git.exe config --local credential.username MyUsername # timeout=30 16:10:28 > git.exe config --local credential.helper store --file=\"C:\Users\Someone\AppData\Local\Temp\git6324638352069465079.credentials\" # timeout=30 16:10:29 > git.exe -c core.askpass=true fetch --tags --progress https://my-server.com/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=120 16:10:31 > git.exe config --local --remove-section credential # timeout=30 16:10:31 > git.exe rev-parse "features/my-feature-branch^{commit}" # timeout=30 16:10:31 > git.exe rev-parse "refs/remotes/origin/features/my-feature-branch^{commit}" # timeout=30 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. SCM Dump I've used the replay function to generate a dump of the scm object (and I've manually indented it for readability) {code:java} node('build') { echo scm.dump() } {code} {noformat} <hudson.plugins.git.GitSCM@5772d35f configVersion=2 userRemoteConfigs=[+refs/heads/*:refs/remotes/origin/* => https://my-server.com/repo.git (origin)] remoteRepositories=[org.eclipse.jgit.transport.RemoteConfig@754a5378] branches=[features/my-feature-branch] doGenerateSubmoduleConfigurations=false gitTool=null browser=hudson.plugins.git.browser.TFS2013GitRepositoryBrowser@9ce7230 submoduleCfg=[] extensions=[ hudson.plugins.git.extensions.impl.CleanBeforeCheckout@472cae27, hudson.plugins.git.extensions.impl.CloneOption@32e5752a, hudson.plugins.git.extensions.impl.CheckoutOption@48c0ceb4, hudson.plugins.git.extensions.impl.LocalBranch@28e8c5d9 ] source=null branch=null choosingStrategy=null relativeTargetDir=null includedRegions=null excludedRegions=null excludedUsers=null skipTag=null disableSubmodules=false recursiveSubmodules=false trackingSubmodules=false gitConfigName=null gitConfigEmail=null pruneBranches=false userMergeOptions=null mergeOptions=null clean=false wipeOutWorkspace=false useShallowClone=false reference=null remotePoll=false authorOrCommitter=false ignoreNotifyCommit=false scmName=null localBranch=null buildChooser=null autoBrowserHolder=null > {noformat} h2. How to reproduce -- Not yet found a way to easily reproduce it -- |
New:
h2. Description of the problem I've a multibranch pipeline project. Sometimes, when I push a commit (ex: bbbbb), this commit is detected by Jenkins, and pull by the master to read the Jenkinsfile. After that, the slave has to pull the repository (using checkout scm), but sometimes it checkout to the wrong commit (previous one, let's say aaaaa instead of bbbbb). h2. Investigation I've connected my debugger to my Jenkins installation. !jenkins-local-branch-bug-1.PNG|thumbnail! It appears that Jenkins has detected 2 branches matching the name. One local and one remote. I can't explicitly specify to Jenkins to use the re h2. Logs {noformat} 16:10:31 Multiple candidate revisions 16:10:31 Checking out Revision 604398f062b459c797f31d6c13b568dd7612362d (features/my-feature-branch) 16:10:31 > git.exe config core.sparsecheckout # timeout=30 16:10:31 > git.exe checkout -f 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe branch -a -v --no-abbrev # timeout=30 16:10:32 > git.exe branch -D features/my-feature-branch # timeout=30 16:10:32 > git.exe checkout -b features/my-feature-branch 604398f062b459c797f31d6c13b568dd7612362d # timeout=120 16:10:32 > git.exe rev-list 0fa6b0371aa1e77a35acdc9f82bb68bb2c32fb2d # timeout=30 {noformat} h2. How to reproduce -- Not yet found a way to easily reproduce it -- |