6

I want jenkins to test the code for review. The jenkins job is started on a push to refs/for/master but it tries to build the origin/master branch and not the refs/changes/XX/X/X branch. Has somebody an idea what i did wrong?

Log from jenkins:

Triggered by Gerrit: http://localhost/13
Building on master in workspace 
/var/lib/jenkins/jobs/CI-JoysteerLogApi/workspace
Checkout:workspace / /var/lib/jenkins/jobs/CI-JoysteerLogApi/workspace - hudson.remoting.LocalChannel@28071488
Using strategy: Default
Last Built Revision: Revision f604c6257923d4231b74573528d0116e0b52dc64 (origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from ssh://jenkinsCI@192.168.5.20:29418/JoysteerLogApi.git
Commencing build of Revision f604c6257923d4231b74573528d0116e0b52dc64 (origin/master)
Checking out Revision f604c6257923d4231b74573528d0116e0b52dc64 (origin/master)

Git config:

Repository URL: ssh://user@localhost:29418/Project.git
Refspec: $GERRIT_REFSPEC
Branches to build: $GERRIT_BRANCH

Gerrit Trigger config:

Gerrit Project:
  Type: Plain
  Pattern: Project
  Branches:
    Type: Path
    Pattern: **
Fabian
  • 1,224
  • 1
  • 11
  • 26

1 Answers1

5

Sorry i haven read the documentation carefully enough...

what was missing in the Git config:

Choosing strategy: Gerrit Trigger

enter image description here

Abhijeet
  • 8,561
  • 5
  • 70
  • 76
Fabian
  • 1,224
  • 1
  • 11
  • 26
  • 1
    I'm been banging my head on this wall for two hours now... and almost asked the same question - with the same answer. I totally missed this buried setting (and it's not the first time I've used it). Have a cookie, and thank you! :-D – MartyMacGyver Sep 26 '12 at 02:35
  • for me the `Refspec: $GERRIT_REFSPEC` was missing - now it works – laplasz Nov 11 '13 at 19:32
  • Thanks! Saved my butt with this one. Looks like the UI has changed slightly in Jenkins 1.643. I had to: Source Code Management -> Git -> Additional Behaviors -> Strategy for Choosing What to build -> Gerrit Trigger. It was hidden from me, so I couldn't figure out how to make my config look like the one from the docs. – Andrew Eisenberg Jan 04 '16 at 20:02
  • @Fabian I don't understand what "Choosing strategy: Gerrit Trigger" does versus just using the "Gerrit event" build trigger checkbox? – David Doria Dec 08 '16 at 20:14