I need to build every commit that gets submitted into a Gerrit repo 
(preferably in order).

I have all the latest git/Gerrit plugins on the latest Jenkins 1.565.2 LTS. 
Jenkins master is running on Linux and slave nodes are running on Windows 7 
with msysgit-1.8.3. The Gerrit server is running 2.9.1.

I've set up a job and set the Gerrit Trigger "Trigger on" field to "Ref 
Updated". The git plugin "Refspec" field is set to "$GERRIT_REFSPEC", the 
"Branches to build" field is set to "$GERRIT_NEWREV", and the "Choosing 
strategy" is set to "Gerrit Trigger".

This works fine until multiple instances of this job get queued up, at 
which point it continues to just build the tip revision of the branch. This 
is particularly apparent if an older job is retriggered. Here's an example.

The tip of "origin/master" is currently at 4d5f54f, but this job should be 
building 0af0a0f. Here are some of the Gerrit environment variables defined 
for the job:

GERRIT_EVENT_TYPE ref-updated
GERRIT_NEWREV     0af0a0fd5c533f258a18ea3bf72add14a3d43a3c
GERRIT_OLDREV     57672ba6daa5674a561911706551e66b70a5c01a
GERRIT_REFSPEC    refs/heads/master

and the log output:

Fetching changes from the remote Git repository
 > C:\Program Files (x86)\Git\cmd\git.exe config remote.origin.url 
 > ssh://gerrit/repo 
# timeout=10
Fetching upstream changes from ssh://gerrit/repo
 > C:\Program Files (x86)\Git\cmd\git.exe --version # timeout=10
using GIT_SSH to set credentials id_dsa
 > C:\Program Files (x86)\Git\cmd\git.exe fetch --tags --progress 
 > ssh://gerrit/repo 
refs/heads/master
 
*> C:\Program Files (x86)\Git\cmd\git.exe rev-parse "FETCH_HEAD^{commit}" # 
timeout=10Checking out Revision 4d5f54fe49ad4adbe8b494a9da3408f4206193a2 
(0af0a0fd5c533f258a18ea3bf72add14a3d43a3c)*
 > C:\Program Files (x86)\Git\cmd\git.exe config core.sparsecheckout # 
timeout=10
 *> C:\Program Files (x86)\Git\cmd\git.exe checkout -f 
4d5f54fe49ad4adbe8b494a9da3408f4206193a2*
 > C:\Program Files (x86)\Git\cmd\git.exe rev-parse "FETCH_HEAD^{commit}" # 
timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe rev-list 
0af0a0fd5c533f258a18ea3bf72add14a3d43a3c # timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe remote # timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe submodule init # timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe submodule sync # timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe config --get remote.origin.url # 
timeout=10
 > C:\Program Files (x86)\Git\cmd\git.exe submodule update --init --
recursive

It looks like the Gerrit Trigger choosing strategy is checking out 
FETCH_HEAD even though I told it to check out "$GERRIT_NEWREV". I can work 
around this fairly easily by adding a "git checkout --force $GERRIT_NEWREV" 
command to the beginning of the build script, but it would be nice for the 
git/Gerrit plugins to handle this case. Is there something I should change 
in the job configuration or is this currently a plugin limitation?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to