I finally figured out how to solve the Gerrit trigger and Git plugin 
integration problems once and for all: stop using the Git plugin and just 
run a few git commands before building instead.

Here's how:

1. select Source control "Source Code Management: None" in your Jenkins job.

2. add a few lines to your shell script to check out the source code. E.g.:

----
# at this point we don't have any source code checked out
set -e
if [ ! -d "src" ]; then
    # look ma! no timeout! :-)
    git clone http://foobar/someproject src
fi
cd src
git fetch origin $GERRIT_REFSPEC
git checkout -f FETCH_HEAD
git clean -fdx
cd ..
---

Voila!

No more Git plugin issues:

- syntax errors with "which branch to build" or "gerrit refspec". This 
syntax has changed over time and any time I upgrade the Gerrit trigger or 
Git plugin, things fall over.
- timeout issues (default timeout is 10 minutes and it is *hard* to change 
this)
- bizarre error messages due to the Git plugin hiding e.g. access denied 
issues under Windows.


Sweet!

I'm kicking myself for not having thought of this sooner and I'm posting 
here in the hope of saving days and weeks of flakiness and frustration for 
other Gerrit trigger plugin users.

There are of course some advantages to the Git plugin, when it works, like 
it being platform agnostic so I'm going to have to write some Python code 
instead of shell scripts to make my cross platform matrix job work. But 
overall it is a relief to kick out the Git plugin.

-- 
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/groups/opt_out.

Reply via email to