简体   繁体   English

当特定文件夹更改时在 Jenkins 中构建触发器

[英]Build trigger in Jenkins when a specific folder changes

Configure Jenkins: Where it should trigger only when a particular folder changes.配置 Jenkins:仅当特定文件夹更改时才应在何处触发。

For example: In a file directory: Sample/Folder/ there are 3 sub folders: F1, F2, F3.例如:在文件目录:Sample/Folder/ 中有 3 个子文件夹:F1、F2、F3。 The jenkins build should be triggered when F3 is changed and should not include F1, F2 in the build. jenkins 构建应在 F3 更改时触发,并且不应在构建中包含 F1、F2。 These 3 folders should be independent in regards to the build but should be in the same file directory.这 3 个文件夹在构建方面应该是独立的,但应该在同一个文件目录中。 Also is there a way we can monitor the changes in the folders?还有一种方法可以监视文件夹中的更改吗?

WIth Jenkins pipelines , start your job by querying the build changeset, as in here .使用Jenkins 管道,通过查询构建变更集开始您的工作,如下所示

See if an when { anyOf { changeset directive is enough to build if and only when the changeset includes a specific element. when { anyOf { changeset且仅当变更集包含特定元素时,查看when { anyOf { changeset指令是否足以构建。

See the pipeline syntax built-in condition查看管道语法内置条件

changeset

Execute the stage if the build's SCM changeset contains one or more files matching the given string or glob.如果构建的 SCM 变更集包含一个或多个与给定字符串或全局匹配的文件,则执行该阶段。 Example: when { changeset "**/*.js" }示例: when { changeset "**/*.js" }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM