Reputation: 8009
I want to trigger a Jenkins build with Gerrit Trigger only when a change to a file in a specific sub-directory is made. For example...
├── subdir1
│ ├── trigger
│ ├── also-trigger
├── subdir2
│ ├── do-not-trigger
If any change to a file in subdir1 is made I want to trigger a build.
Upvotes: 3
Views: 8721
Reputation: 21
There's an unexpected behaviour with Gerrit Trigger plugin when you select "Ref Updated" as the trigger event. It does not care about File Path option. But if you have a UI pull request way of doing things, it means you'll be merging changes through UI. So, you can try using "Change Merged" on "Trigger on" section.
Having a look at the parameters of the job, when a change-merged is triggered, there is information about the changeset that triggers the build. On the contrary, when you use ref-updated, there's no information about the changeset, so it is not possible to check for file inclusion. https://bugs.chromium.org/p/gerrit/issues/detail?id=2483
Upvotes: 2
Reputation: 5485
Check Gerrit event
in your Jenkins project configuration. In Gerrit settings Add File path
with path
subdir1
(of course you should set project and branches patterns). Then any changes in subdir1
will activate Jenkins, and changes from subdir2
will be ignore by Jenkins.
Upvotes: 3