VSTS:在构建过期的情况下自动重定位/合并并重新构建验证门 [英] VSTS : automatically rebase/merge and requeue build validation gate in case of build expiration

查看:168
本文介绍了VSTS:在构建过期的情况下自动重定位/合并并重新构建验证门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近对PR上的构建验证门进行了更改,以便在当前PR完成之前,如果另一个提交将其转换为主分支,则构建将立即过期。请参阅此处

尽管这种变化确保了主人始终准确/可建立/健康,但这似乎对开发人员生产力几乎没有负面影响:


  1. 团队成员必须持续关注其PR以重新进行构建验证。
  2. 不仅需要手动重新构建,但在此之前,他们必须在重新安排分支之前手动重新绑定分支。

  3. 随着我们迈向掌握更多更小/可装载的签入,预计会增加这种情况。

我想自动执行(1)和(2)。有没有一种方法可以设置VSTS构建验证,以便对于所有打开的PR,在构建到期后,它会自动将主分支与主分支重新绑定/重新汇合,然后重新构建?

解决方案

我在我的组织遇到了这个问题。设置立即过期到期变得太麻烦,当有多个PR都试图进入同一时间。



AFAIK - 没有办法自动当更新 master 时,触发重新构建所有以 master 为目标的PR。如果你想要挂钩VSTS事件并自己编写代码,我确信基本知识就在那里。但是我上次看的时候没有任何东西。




我的组织所做的就是接受折中方案。我们配置PR,以便在1小时后生成过期。这种方式在多个PR试图同时合并时没有争用。然而,这在你的原始问题中描述的缺点 VSTS:在另一个提交将其转换为主分支时,将现有PR上的内部版本无效化,目标分支(例如, master )可能存在由于两个不兼容的PR的快速合并而被打破。



我们已经结束了接受这个限制




  • 我们在所有分支上都有一个触发器(feature, master 等)提交被添加,我们自动触发一个新的构建。通过这种方式,如果PR设法打破 master ,我们会在几分钟内收到关于它的电子邮件。

  • >如果主分支(即 master )被破坏,所有新的PR将开始失败构建。因此,没有新的PR可以合并进来。这通常会引起每个人的注意,所以问题很快就会浮现出来 - 整个团队开始着手解决 master

  • 在部署 master 之前,我们运行一个完整的VSTS版本,包括单元测试。这样,如果主分支被破坏(由两个不兼容的PR或其他原因),我们确保我们停止部署。




所以,不幸的是,我们不能保证 master 始终处于良好状态的100%。达到100%只会对我们的工作流程和生产力产生太多负面影响。所以我们接受我们的限制,确保我们尽快得到通知,并且可以在分支机构中断时处理这种情况。


We recently made a change to our build validation gate on PRs such that the builds expire "immediately" if another commit makes it into master branch before the current PR completes. See here.

Even though this change ensures that the master is always accurate/buildable/healthy, this seems to have few negative effects on developer productivity :

  1. team members have to continuously keep an eye on their PRs to requeue builds validations.
  2. Not only they have to requeue builds manually, but prior to doing that they have to manually rebase their branch before requeueing.
  3. as we move towards more smaller/shippable checkins in to master, the no. of times this occurring is expected to increase.

I want to automate (1) and (2). Is there a way I can setup VSTS build validation such that for all open PRs, upon build expiry, it automatically rebases/remerges the source branch with master and then requeues the build ?

解决方案

I've run into this exact problem at my organization. Setting Build expiration to Immediately becomes too burdensome when there are multiple PRs all trying to get into the same time.

AFAIK - there's no way to automatically trigger a rebuild of all PRs targeting master whenever master is updated. I'm sure the basics are there if you want to hook into VSTS events and write the code yourself. But there's nothing out-of-box last time I looked.


What my organization did was to accept a compromise. We configure PRs so the build expires after 1 hour. This way there's no contention when multiple PRs are trying to be merged at the same time. However, this has the downside you describe in your original question VSTS : Invalidating builds on existing PRs when another commit makes it into master branch where it's possible for the target branch (ie master) to become broken because of a quick merger of two incompatible PRs.

We've ended up just embracing this limitation

  • We have a trigger on all of our branches (feature, master, etc) that whenever new commits are added, we automatically trigger a new build. This way if a PR managed to break master we get an email about it within a few minutes.

  • If the main branch (ie master) becomes broken, all new PRs will start failing builds. Thus, no new PRs can be merged in. This usually gets everyone's attention so the problem quickly bubbles up to the surface - and the whole team starts working to fix master.

  • Before we deploy master we run a full VSTS build, including unit tests. This way, if the main branch is broken (by two incompatible PRs or for any other reason) we make sure we halt the deployment.

So, unfortunately, we can't guarantee that master is always a 100% in a good state. Getting to 100% is just has too much negative impact on our workflow and productivity. So we embrace our limitations and make sure we are notified asap and can handle the situation when the branch breaks.

这篇关于VSTS:在构建过期的情况下自动重定位/合并并重新构建验证门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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