I am seeing this issue in our builds. Our specifier is `refs/remotes/origin/dev`. I created a copy of the job that was "corrupted" and it worked for 1-2 weeks and then starting building on every commit in git (not just commits to our dev branch).
The git polling log shows an incorrect git hash after several correct git hashes.
In the below log, hash 1db609585eedb7d551abe735b69b8aa08bf57b2e is a commit on May 24 and hash 13b0645d2d0eef5a33f2cca02e26ff8161fe13fd is a commit from May 26. The polling log correctly shows it finding the May 26 commit several times and then, seemingly randomly, it finds the May 24 hash.
Example output from the git polling log in Jenkins:
> git ls-remote -h – git@github.com:my-company-tools/our-code.git # timeout=10
Found 438 remote heads on git@github.com:my-company-tools/our-code.git
[poll] Latest remote head revision on refs/heads/dev is: 13b0645d2d0eef5a33f2cca02e26ff8161fe13fd
Using strategy: Default
[poll] Last Built Revision: Revision 13b0645d2d0eef5a33f2cca02e26ff8161fe13fd (refs/remotes/origin/dev)
The recommended git tool is: git
using credential theDeployKey
> git --version # timeout=10
> git --version # 'git version 2.17.1'
using GIT_SSH to set credentials Deploy key for our-code mono-repository in GitHub
Verifying host key using manually-configured host key entries
> git ls-remote -h – git@github.com:my-company-tools/our-code.git/ # timeout=10
Found 438 remote heads on git@github.com:my-company-tools/our-code.git/
Using strategy: Default
[poll] Last Built Revision: Revision 1db609585eedb7d551abe735b69b8aa08bf57b2e (refs/remotes/origin/dev)
The recommended git tool is: git
using credential theDeployKey
> git --version # timeout=10
> git --version # 'git version 2.17.1'
using GIT_SSH to set credentials Deploy key for our-code mono-repository in GitHub
Verifying host key using manually-configured host key entries
> git ls-remote -h – git@github.com:my-company-tools/our-code.git # timeout=10
Found 438 remote heads on git@github.com:my-company-tools/our-code.git
[poll] Latest remote head revision on refs/heads/dev is: 13b0645d2d0eef5a33f2cca02e26ff8161fe13fd
Done. Took 13 sec
Changes found
I found this in our groovy:
script.checkout([
$class: 'GitSCM',
branches: [[name: "*/${gitBranch}"]],
doGenerateSubmoduleConfigurations: false,
I changed it to try:
script.checkout([
$class: 'GitSCM',
branches: [[name: "refs/remotes/origin/${gitBranch}"]],
doGenerateSubmoduleConfigurations: false,
We are still seeing the issue. I'm going to have someone in IT try deleting the workspace folder to see if that helps. Any other suggestions?
dmaxfield I don't know of any other work arounds beyond those that I listed earlier.