Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins gerrit trigger not fetching my change when building

I have configured jenkins with gerrit trigger plugin to validate every commit we review to gerrit. I am expecting this trigger to include my latest change with original repo and make a build. But, it is cloning only repo project and compiling without my change. Below is my configuration settings for gerrit trigger in jenkins.

Refspec: $GERRIT_REFSPEC 
Branches to build: $GERRIT_BRANCH 
Build trigger: Gerrit event 
Trigger on: patch set created 
Gerrit project: added project and branch
like image 726
XiaoSI Lu Avatar asked Jan 04 '23 12:01

XiaoSI Lu


1 Answers

Refspec: $GERRIT_REFSPEC point to refs/changes/XX/XXXXX/X

If you want get code from gerrit,you should execute this cmd in your Build step:

git fetch $GIT_URL $GERRIT_REFSPEC && git checkout FETCH_HEAD

OR you can try this:

https://wiki.jenkins.io/display/JENKINS/Gerrit+Trigger

To get the Git Plugin to download your change;

  1. set Refspec to $GERRIT_REFSPEC
  2. set 'Branches to build' to $GERRIT_BRANCH.

If this does not work for you

  1. set Refspec to refs/changes/:refs/changes/
  2. set 'Branches to build' to $GERRIT_REFSPEC.
like image 104
wwl1991 Avatar answered Jan 11 '23 15:01

wwl1991