返回介绍

2.5.18.2. OldBuildCanceller

发布于 2023-09-20 23:50:39 字数 3133 浏览 0 评论 0 收藏 0

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

2.5.18.2. OldBuildCanceller

class buildbot.plugins.util.OldBuildCanceller

The purpose of this service is to cancel builds on branches as soon as a new commit is detected on the branch.

This allows to reduce resource usage in projects that use Buildbot to run tests on pull request branches. For example, if a developer pushes new commits to the branch, notices and fixes a problem quickly and then pushes again, the builds that have been started on the older commit will be cancelled immediately instead of waiting for builds to finish.

The service may be configured to track a subset of builds. This is controlled by the filters parameter. The decision on whether to track a build is done on build startup. Configuration changes are ignored for builds that have already started.

Certain version control systems have multiple branch names that map to a single logical branch which makes OldBuildCanceller unable to cancel builds even in the presence of new commits. The handling of such scenarios is controlled by branch_key.

The following parameters are supported by the OldBuildCanceller:

name

(required, a string) The name of the service. All services must have different names in Buildbot. For most use cases value like build_canceller will work fine.

filters

(required, a list of two-element tuples) The source stamp filters that specify which builds the build canceller should track. The first element of each tuple must be a list of builder names that the filter would apply to. The second element of each tuple must be an instance of buildbot.util.SourceStampFilter.

branch_key

(optional, a function that receives source stamp or change dictionary and returns a string) Allows customizing the branch that is used to track builds and decide whether to cancel them. The function receives a dictionary with at least the following keys: project, codebase, repository, branch and must return a string.

The default implementation implements custom handling for the following Version control systems:
  • Gerrit: branches that identify changes (use format refs/changes/*/*/*) have the change iteration number removed.

Pass lambda ss: ss['branch'] to always use branch property directly.

Note that OldBuildCanceller will only cancel builds with the same project, codebase, repository tuple as incoming change, so these do not need to be taken into account by this function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文