[英]exact use of “Forbidden File path” of the Jenkins Gerrit Trigger plugin
The Jenkins Gerrit Trigger Plugin has a button "Add Forbidden File path" but actually there is not too much documentation avaiable for it. Jenkins Gerrit Trigger插件有一个“添加禁止文件路径”按钮,但实际上没有太多可用的文档。
So what is the exact behavior of it? 那它的确切行为是什么?
This leads mit to the question if: 这导致了一个问题,如果:
"File Path"= ^((?!_abc)(?!_def).)*$
“文件路径”=
^((?!_abc)(?!_def).)*$
behaves equal to: 行为等于:
"Forbidden File Path"= ^.*_abc$|^.*_def$
? “禁止文件路径”=
^.*_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
. Add Forbidden file path
优先级高于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).)*$
“文件路径”= ^((?!_ abc)(?!_ def)。)* $
behaves equal to:
行为等于:
"Forbidden File Path"= ^.
“禁止文件路径”= ^。 _abc$|^.
_abc $ | ^。 _def$ ?
_def $?
Probably you made a mistake: ^((?!_abc)(?!_def).)*$
instead of ^.*(?!_abc)(?!_def)$
. 可能你犯了一个错误:
^((?!_abc)(?!_def).)*$
而不是^.*(?!_abc)(?!_def)$
。 Because in first case you compare right from start ( ^
) and your quantifier ( *
) repeats whole expression, not a .
因为在第一种情况下你从开始比较(
^
)和量词( *
)重复整个表达式,而不是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. Add File path
则Add File path
。 But Add Forbidden File path
inhibits build if any of file found. Add Forbidden File path
禁止构建。 Add File path
with **
at least to start work Add Forbidden File path
. Add File path
**
至少开始工作Add Forbidden File path
。 Add Forbidden File path
doesn't work if Add File path
is empty. Add File path
为空,则Add Forbidden File path
不起作用。 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. 根据文档,我的需求应该与插件的V2.16.0 (参见JENKINS-30620 )一起使用 - 应该使用新选项“ 禁用严格的禁止文件验证 ”。
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 : 但至少我通过“添加文件路径”参数使其工作 ,这要归功于JENKINS-19891中提供的信息 :
However, since the commit always contains COMMIT_MSG file, it will match the regex and triggers the build.
但是,由于提交始终包含COMMIT_MSG文件,因此它将匹配正则表达式并触发构建。
So I added the commit message file to my regexes which finally gives me the correct results. 所以我将提交消息文件添加到我的正则表达式,最终给了我正确的结果。
Example: ^((?!\\/COMMIT_MSG|cunit|_abc|_def[\\/\\.]).)*$
示例:
^((?!\\/COMMIT_MSG|cunit|_abc|_def[\\/\\.]).)*$
...for ignoring changes in files who's name (including path) contains any of "cunit", "_abc", "_def." ...忽略文件中的更改名称(包括路径)包含“cunit”,“_ abc”,“_ unde”中的任何一个。 or "_def/"
或“_def /”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.