0
votes

I am using Gerrit review combined with Jenkins.

As a developer pushes his/hers code to GIT they push using:

git push HEAD:refs/for/master

In jenkins I use the gerrit trigger to trigger build when "patchset created"

The settings in Jenkins look like:

GIT:

ssh://git.server.com/path/to/project

Refspec: $GERRIT_REFSPEC

Branches to build: left empty or $GERRIT_BRANCH or refs/changes/*

GERRIT TRIGGER:

Trigger on: "Patchset Created"

PROJECT:

Path: path/to/project

branch:**

The build is triggered okay as the push is made but it clones out the wrong version/branch. The changes pushed are not in the code built. Am I thinking wrong here?

As you can see I tried different branches in the GIT plugin. But jenkins git plugin clones out the wrong version/branch. What am I doing wrong?

I have other jobs triggering on "ref updated" that work fine.

1
Branches to build should be set to $GERRIT_BRANCH. What is the value of $GERRIT_BRANCH in the build that you believe is on the wrong branch?user600838

1 Answers

0
votes

Found a possible solution (correct if I'm wrong :))

In the 'Branches to build" section of the GIT plugin put in the GERRIT environment variable:

$GERRIT_PATCHSET_REVISION