-
Bug
-
Resolution: Fixed
-
Blocker
-
None
-
Ubuntu, Jenkins 1.656, VSphere plugin 2.53, Git plugin 2.5.1 or 2.5.2
The git plugin is unable to find revisions to build in environments where the current user is not Jenkins.
This problem was introduced in git 2.5.1, 2 releases, and was not present in the 2.5.0 release.
On builds where the build user is not Jenkins (the slave is running as a different user), the job aborts due to git errors.
e.g:
14:48:47 Started by user jmellor
14:48:47 Starting limited count build: 1
14:48:47 [EnvInject] - Loading node environment variables.
14:48:47 Building remotely on robot-testbuilder-1 (robot-testbuilder) in workspace /var/lib/jenkins/workspace/soc-dashboard_dev_nightly
14:48:50 Wiping out workspace first.
14:48:50 Cloning the remote Git repository
14:48:50 Cloning repository ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:48:50 > /usr/bin/git init /var/lib/jenkins/workspace/soc-dashboard_dev_nightly # timeout=10
14:48:50 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:48:50 > /usr/bin/git --version # timeout=10
14:48:50 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
14:49:13 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
14:49:14 > /usr/bin/git config --add remote.origin.fetch refs/heads/develop # timeout=10
14:49:14 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
14:49:14 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:49:14 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
14:49:14 > /usr/bin/git rev-parse origin/develop^
14:49:14 > /usr/bin/git rev-parse develop^{commit}
# timeout=10
14:49:14 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
14:49:14 Retrying after 10 seconds
14:49:24 Wiping out workspace first.
14:49:24 Cloning the remote Git repository
14:49:24 Cloning repository ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:49:24 > /usr/bin/git init /var/lib/jenkins/workspace/soc-dashboard_dev_nightly # timeout=10
14:49:24 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:49:24 > /usr/bin/git --version # timeout=10
14:49:24 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
14:49:46 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
14:49:46 > /usr/bin/git config --add remote.origin.fetch refs/heads/develop # timeout=10
14:49:46 > /usr/bin/git config remote.origin.url ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git # timeout=10
14:49:46 Fetching upstream changes from ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git
14:49:46 > /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://jmellor@gerrit.internal:29418/socdash/soc-dashboard.git refs/heads/develop
14:49:46 > /usr/bin/git rev-parse origin/develop^
14:49:46 > /usr/bin/git rev-parse develop^{commit}
# timeout=10
14:49:46 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
My current workaround is to revert all the way back to git plugin 2.4.4 (which I had laying around), and the fault does not exhibit anymore. This build is also known to have been working for months with the git plugin 2.5.0 release.
- is duplicated by
-
JENKINS-36563 Git plugin does not fetch branch to merge to when merge before build is used
-
- Closed
-
-
JENKINS-21845 Command "git rev-parse /develop^{commit}" returned status code 128
-
- Closed
-
- is related to
-
JENKINS-31393 Git plugin fetches all branches before fetching the specified refspec
-
- Closed
-
-
JENKINS-33140 Git plugin doesn't use refspec on the first clone/fetch
-
- Closed
-
[JENKINS-36507] git plugin 2.5.2 breaks builds which use a narrow refspec but expect all refs were fetched
Link |
New:
This issue is related to |
Summary | Original: git plugin 2.5.2 breaks some existing builds | New: git plugin 2.5.2 breaks builds which use a narrow refspec but expect all refs were fetched |
Attachment | New: gerrit-config.PNG [ 33246 ] | |
Attachment | New: Parameters.PNG [ 33247 ] | |
Attachment | New: slave-config.PNG [ 33248 ] |
It appears that your build is defined with a narrow refspec ("refs/heads/develop"), but your build then assumes that the entire repository was fetched, even though a narrow refspec was provided. I believe that means your build depends on bug
JENKINS-31393in the git plugin.JENKINS-31393was fixed in git plugin 2.5.1. Prior to git plugin 2.5.1, the refspec provided by the user was ignored for the initial fetch. That meant that no matter what refspec was provided by the user, the entire repository was fetched. Users with large repositories didn't like that the refspec they constructed was ignored on initial fetch, since it increased the size of the cloned repository and took longer to clone that repository.With the fix of
JENKINS-31393, the refspec is honored on the initial fetch. One alternative to handle that case is to add an additional refspec to your job definition which will include all the commits. For example, your current refspec seems to be "refs/heads/develop". The new refspec could beI'm not sure how your build could have been working for months with git plugin 2.5.0, since git plugin 2.5.0 released less than a month ago, 19 Jun 2016. Were you using one of the 2.5.0 beta versions prior to 19 Jun 2016, or was it that you were using git plugin 2.4.4 successfully for months?
There is a note in the changelog under 2.5.1 describing the risk of this happening. It says "some users may depend on the old, poor behavior that the plugin fetched all refspecs even though the user had specified a narrower refspec. Those users can delete their refspec or modify it to be as wide as they need". Unfortunately, I didn't see a way to preserve the old behavior (fetch everything) and fix
JENKINS-31393.Another way to retain compatibility with the old "fetch everything initially" behavior would be to require that users who want the fix for
JENKINS-31393must add the "Additional Behaviour" for "Advanced clone behaviours". In that "advanced behaviors" there would be a check box added to "Honor refspec on initial clone". If a large number of users are affected by this same condition, that may be the preferred approach.