The Jenkins Gerrit Trigger Plugin has a button "Add Forbidden File path" but actually there is not too much documentation avaiable for it.
So what is the exact behavior of it?
This leads mit to the question if:
"File Path"= ^((?!_abc)(?!_def).)*$
behaves equal to:
"Forbidden File Path"= ^.*_abc$|^.*_def$
?
Does it inhibit the trigger if one of the changed files match? Or does it inhibit the trigger if all of the changed files match? (in other words: only matching files have changed)
According commit message trigger is inhibit if any file is matched.
This forbidden file allows the project not to trigger if any forbidden file has been impacted.
I suppose it "overrides" a match of "Add File Path", doesn't it?
Yes. Add Forbidden file path
has higher priority than Add File path
.
does it work for directory names only or down to file names?
For both. But it is hard to add empty folder.
This leads mit to the question if:
"File Path"= ^((?!_abc)(?!_def).)*$
behaves equal to:
"Forbidden File Path"= ^._abc$|^._def$ ?
Probably you made a mistake: ^((?!_abc)(?!_def).)*$
instead of ^.*(?!_abc)(?!_def)$
. Because in first case you compare right from start (^
) and your quantifier (*
) repeats whole expression, not a .
.
In second case we have a different behavior for two or more files. Because
Add File path
starts build if any of them found. But Add Forbidden File path
inhibits build if any of file found.Add File path
with **
at least to start work Add Forbidden File path
. Add Forbidden File path
doesn't work if Add File path
is empty.According to the docs my needs should be adressed with V2.16.0 of the Plugin (see JENKINS-30620) - the new option "Disable Strict Forbidden File Verification" should be used for this.
In the help it says:
- Enabling this option will allow an event to trigger a build if the event contains BOTH one or more wanted file paths AND one or more
forbidden file paths.- In other words, with this option, the build will not get triggered if the change contains only forbidden files, otherwise it will get triggered.
So I took a day of testing but it doesn't seem to work at my site.
But at least I got it working via the "Add File Path" parameter, thanks to the information that was postet in JENKINS-19891:
However, since the commit always contains COMMIT_MSG file, it will match the regex and triggers the build.
So I added the commit message file to my regexes which finally gives me the correct results.
Example: ^((?!\/COMMIT_MSG|cunit|_abc|_def[\/\.]).)*$
...for ignoring changes in files who's name (including path) contains any of "cunit", "_abc", "_def." or "_def/"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With