VSTS发布拉取请求构建触发器 [英] VSTS release pull request build trigger

查看:61
本文介绍了VSTS发布拉取请求构建触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队正在使用VSTS Build&释放机制,结合了拉取请求分支的安全性设置,因此只有在拉取请求完成后才能合并代码.

My team are using the VSTS Build & Release mechanism, combined with pull request branch safety settings, so that code can only be merged in when a pull request is completed.

尽管如此,我们遇到了一些奇怪的事情,因为当创建请求请求时(生成了一个构建以证明提交),由请求请求触发的构建完成也间接触发了发布,因为我们有一个释放触发器设置.

We are experiencing something odd though, in that when a pull-request is created (and a build is spawned to prove the commit) - the completion of this build triggered by the pull request also indirectly triggers a release because we have a release trigger setup.

这本身可能还可以,但是随后发生的情况是在完成"拉取请求后进行的另一次构建和测试.释放周期就发生了!

This in itself is probably ok, but then what also happens is upon 'completing' the pull request, another build & release cycle takes place!

有没有一种方法可以使VSTS释放触发器仅在拉取请求完成并合并到release分支后才启动?

Is there a way of making VSTS release triggers only kick in when the pull request is completed and merged into the release branch?

谢谢!

推荐答案

我们可以在发布触发器上指定一个分支过滤器,以便只有master版本才可以触发发布. PR验证构建是在另一个分支中完成的.批准后,分支合并到master中,这就是您要触发发行版的版本.

We can specify a branch filter on the release trigger such that only builds of master will trigger a release. PR validation builds are done in a different branch. When approved and the branch is merged into master, that's the build you want triggering a release.

令人讨厌的是,他们不断移动东西.在撰写本文时,在工件的管道"下,工件"下,编辑发行版时,内部有一个带有闪电的圆圈,工具提示会显示连续部署触发器"-单击此按钮.在右侧,如果启用了触发器,您将看到构建分支过滤器".单击"+添加",然后选择主分支.保存发布定义.

Annoyingly, they keep moving things around. At the time of this writing, when editing a release, under Pipeline, under Artifacts, on the artifact, there is a circle with a lightning bolt inside, tooltip says "Continuous deployment trigger" - click that. On the right, if the trigger is enabled, you'll see "Build branch filters". Click "+ Add" and select the master branch. Save the Release definition.

对于执行不同操作的构建,我们现在可以在任务上设置条件,这样您就可以使任务仅在PR验证构建或主构建上运行.

As for the build doing different things, we can now set conditions on tasks such that you can have a task only run on PR validation builds or only on master builds.

https://docs.microsoft.com/zh-cn/vsts/build-release/concepts/process/conditions

这篇关于VSTS发布拉取请求构建触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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