2

I am having troubles how to properly configure Gerrit trigger to only triggers when changes are made to master or other branches (excluding refs/for/rev).

For now I have type:Path, pattern: **/* but it catches any changes (on master/branches and on refs/for/*)

How to construct correct pattern to trigger when refspecs changes only on master and branches but not on refs/for/* ?

jozefow
  • 626
  • 3
  • 14
  • 1
    I think you are confused about the "refs/for" term. There's no refs/for/BRANCH. "refs/for" is the way Gerrit uses to know that you're trying to create a review instead of push straight to the branch. Are you trying to trigger the build when the change is effectively integrated to the branch and not when the change is created? See more info here: https://gerrit-review.googlesource.com/Documentation/intro-quick.html – Marcelo Ávila de Oliveira Aug 02 '17 at 12:49
  • yes, I know the Gerrit way, I already have a job which is triggered by new reviews,now I am seeking how to trigger a job when developer is doing `git push origin branch` but not get triggered when `git push origin refs/for/branch` – jozefow Aug 02 '17 at 12:54

1 Answers1

2

In Jenkins > Job > Configure > Gerrit Trigger > Trigger on

Add: Change Merged

Do not use any other event like "Patchset Created" or "Draft Published"

  • Thanks, what about Gerrit Project -> Pattern, Path set to ** does not work for Change Merged? (job is not triggered) – jozefow Aug 02 '17 at 13:14
  • It works the same way (Path=**/* should work for every project). Have you submitted some change and the job was not trigged? – Marcelo Ávila de Oliveira Aug 02 '17 at 13:45
  • job is triggered with Change Merged and Plain=master, it is not triggered when Path=`**/*` nor `**` nor `**/**` . When changed to trigger on Refs Updated for Path = `**/*` it is also triggered. There is something simple and stupid to be fixed but I don't see it. – jozefow Aug 03 '17 at 08:11
  • Plain=master?!? Are you talking about project configuration (first type/pattern configuration) or branch configuration (second type/pattern configuration)? For branch configuration Path=** should trigger for every branch. – Marcelo Ávila de Oliveira Aug 03 '17 at 11:20
  • I am talking about Branch configuration, project is set to Plain= . I am aware that branch set to Path=`**` should work but it does not and I don't know why. – jozefow Aug 03 '17 at 11:51
  • In your first comment you've said "Gerrit Project -> Pattern"... anyway... Path=** should work for any branch, maybe there's some bug, you could try RegExp=.* to see if works. – Marcelo Ávila de Oliveira Aug 03 '17 at 12:50