詹金斯的工作可以监视一个存储库中的更改,以触发另一个存储库上的构建吗? [英] Can Jenkins job watch one repo for changes, to trigger a build on another repo?

查看:139
本文介绍了詹金斯的工作可以监视一个存储库中的更改,以触发另一个存储库上的构建吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用詹金斯和管道;

我有一个仓库可以驱动部署,克隆它的Jenkinsfile应该可以启动一个新的仓库.但是我需要詹金斯(Jenkins)工作,将其包装起来以观看代表该站点的另一个存储库(而不是其构建过程),以监视并构建对该站点的更改(预期会经常更改),而不是构建过程,希望该构建过程将很快变得稳定且不会有太多其他更改.

I have one repo which drives deployments and cloning its Jenkinsfile should kick off a new build; but I need the jenkins job which wraps it to watch another repo representing the site (not its build process), to watch for and build changes to the site, expected to change often, rather than the build process which hopefully will soon be stable and not subject to much additional change.

任何人都可以告诉我如何完成这项壮举吗?

Can anyone please advise me how it is I would accomplish this feat?

推荐答案

通常,我建议将Jenkinsfile与源代码存储在相同的存储库中.只有这样,您才能拥有合并的历史记录,这样一来,从-假设-一年前重现较旧的版本会容易得多.

Usually I‘d recommend to have the Jenkinsfile in the very same repository like your source code. Only that way you will have a combined history so it‘ll be much easier to reproduce an older build from - let’s say - one year ago.

但是,如果您仍然想进行分离:git/checkout步骤通常可以在Jenkins中添加一个钩子,这样作业将在更改时自动触发.

However if you still want to go for the separation: The git/checkout steps will usually have the possibility to add a hook in Jenkins so the job will get triggered automatically on changes.

如果我确实正确理解了您的用例,则Jenkinsfile将进入稳定状态.如果稳定的话,就不会改变.如果没有任何更改,就不会触发工作,对吧?

If I did understand your use case correctly the Jenkinsfile will go into stable state. If it’s stable it won’t change. When there are no changes it won’t trigger the job, right?

如果这还不够,我想我需要更多有关您要实现的目标以及原因的详细信息.

If that still is not enough I think I would need more details on what you’re trying to achieve and why.

这篇关于詹金斯的工作可以监视一个存储库中的更改,以触发另一个存储库上的构建吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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