Jenkins:在企业github中修改特定文件时,是否有一种简单的方法来触发jenkins作业? [英] Jenkins: is there a simple way to trigger jenkins job when a specific file is modified in enterprise github?

查看:136
本文介绍了Jenkins:在企业github中修改特定文件时,是否有一种简单的方法来触发jenkins作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在企业github中修改特定文件时,是否有一种简单的方法来触发jenkins作业?

Is there a simple way to trigger jenkins job when a specific file is modified in enterprise github?

例如:

github: https://example.git.lab.com
repo: testrepo

如果回购文件中名为 base.cfg 的文件被更改,则会触发并执行Jenkins中的Jenkins自由式作业.谢谢.

If a file named base.cfg in the repo is changed, then a Jenkins freestyle job in Jenkins is triggered and executed. Thanks.

我检查了git和github插件,但没有发现它们具有此功能.

I checked git and github plugin, but didn't find they have this functionality.

推荐答案

在您的Jenkins自由式作业配置页面中:

In your Jenkins freestyle job configuration page:

  1. 源代码管理下,选择 Git .
  2. 指定存储库URL,凭据和分支.
  3. 其他行为旁边,单击添加,然后选择轮询忽略某些路径中的提交.
  4. 包含的区域文本框中,指定相对于存储库根目录的文件路径.您可以在换行中指定多个文件路径或正则表达式模式.
  5. 保存更改.
  1. Under Source Code Management, select Git.
  2. Specify the repository URL, credentials, and branch.
  3. Next to Additional Behaviours, click Add and then select Polling ignores commits in certain paths.
  4. In the Included Regions textbox, specify the filepath relative to the root of the repository. You can specify multiple filepaths or regex patterns in new lines.
  5. Save the changes.

假设您已经配置了Gitlab webhooks ,则此工作将是仅当指定文件已更新时才触发.存储库中的其他文件将被忽略.

Assuming that you have already configured Gitlab webhooks, this job will be triggered only when the specified file(s) have been updated. The other files in the repository will be ignored.

这篇关于Jenkins:在企业github中修改特定文件时,是否有一种简单的方法来触发jenkins作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆