Reputation: 16329
I have set the Gerrit-Git-Jenkins combination. I'm using the following plugins for Jenkis.
I'm running a dummy Jenkins job which always succeeds for development purposes. I have notices that when I push changes to Gerrit, the files don't show in the Jenkins workspace.
The repository URL which is set in the Jenkins Git configuration is git://localhost/project
i have tried cloning it manually and git clone git://localhost/project
gets the files which i would expect it to.
What repository does Jenkins clone to populate its workspace?
It clones git://localhost/project
. I've tested this by running git remote show origin
as the build script, and then looking at the log output.
What command does Jenkins run to populate the workspace for it seems it isn't cloning of the HEAD?
Upvotes: 2
Views: 3343
Reputation: 4044
Just for the record, to checkout Gerrit review request (i.e., a particular patchset), configure following 3 config options in Jenkins/Hudson job:
Repositories -> Repository URL
: the git url of gerrit project
(e.g., http://gerrit.corp.com/the-project)
Repositories -> Refspec
(Advanced Git Settings): refs/changes/*:refs/changes/*
Branches to be built -> Branch Specifier
): refs/changes/XY/??XY/? refs/changes/24/3124/8
)The Alan's answer is correct. It's just not clear enough imho which is why I'm trying to elaborate the answer in other words.
Upvotes: 3
Reputation: 16329
Jenkins does the following to populate its workspace. (names in <> represent the field names in Jenkins project configuration):
git clone <Repository URL>
git fetch <Refspec>
git checkout <Branch Specifier>
The setting which populates the workspace with the files in Gerrit which are awaiting verification are:
Refspec: refs/changes/*:refs/changes/*
Branches to build: $GERRIT_REFSPEC
This clones everything from refs/changes/*
from Gerrit and populates the workspace from files referenced as the branch $GERRIT_REFSPEC
. $GERRIT_REFSPEC
is different for each new change Gerrit receives, it look something like this refs/changes/05/5/1
.
Upvotes: 5