Jenkins用git稀疏结账触发

Gur*_*van 4 git triggers jenkins

我有一个很大的git存储库,我在Jenkins中为它创建了多个作业.
我使用git sparse checkout功能每次只同步它的必要部分.
此外,我希望只有在代码的相关部分发生更改时才会触发SCM轮询功能.实际上,无论提交什么,它都会触发所有作业.

我的问题:如何确保只在相关文件发生变化时触发作业?
此外,从"Jenkins轮询GIT"切换到"从Gitlab触发"是否可以解决这个问题?

Mar*_*tin 6

Additional BehavioursJenkins Git插件的下拉列表中有一个选项叫做Polling ignores commit in certain paths.在那里你可以指定包含和排除的路径来控制SCM轮询的行为.

从插件的文档:

Each inclusion uses regular expression pattern matching, and must be separated by a new line.
An empty list implies that everything is included.

    myapp/src/main/web/.*\.html
    myapp/src/main/web/.*\.jpeg
    myapp/src/main/web/.*\.gif

The example above illustrates that a build will only occur, if html/jpeg/gif files have been committed to the SCM.
Exclusions take precedence over inclusions, if there is an overlap between included and excluded regions.
Run Code Online (Sandbox Code Playgroud)