返回介绍

3.8.4. Builds connector

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

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.4. Builds connector

class buildbot.db.builds.BuildsConnectorComponent

This class handles builds. One build record is created for each build performed by a master. This record contains information on the status of the build, as well as links to the resources used in the build: builder, master, worker, etc.

An instance of this class is available at master.db.builds.

Builds are indexed by buildid and their contents represented as builddicts (build dictionaries), with the following keys:

  • id (the build ID, globally unique)

  • number (the build number, unique only within the builder)

  • builderid (the ID of the builder that performed this build)

  • buildrequestid (the ID of the build request that caused this build)

  • workerid (the ID of the worker on which this build was performed)

  • masterid (the ID of the master on which this build was performed)

  • started_at (datetime at which this build began)

  • complete_at (datetime at which this build finished, or None if it is ongoing)

  • state_string (short string describing the build’s state)

  • results (results of this build; see Build Result Codes)

getBuild(buildid)
Parameters:

buildid (integer) – build id

Returns:

Build dictionary as above or None, via Deferred

Get a single build, in the format described above. Returns None if there is no such build.

getBuildByNumber(builderid, number)
Parameters:
  • builder (integer) – builder id

  • number (integer) – build number within that builder

Returns:

Build dictionary as above or None, via Deferred

Get a single build, in the format described above, specified by builder and number, rather than build id. Returns None if there is no such build.

getPrevSuccessfulBuild(builderid, number, ssBuild)
Parameters:
  • builderid (integer) – builder to get builds for

  • number (integer) – the current build number. Previous build will be taken from this number

  • ssBuild (list) – the list of sourcestamps for the current build number

Returns:

None or a build dictionary

Returns the last successful build from the current build number with the same repository, branch, or codebase.

getBuilds(builderid=None, buildrequestid=None, complete=None, resultSpec=None)
Parameters:
  • builderid (integer) – builder to get builds for

  • buildrequestid (integer) – buildrequest to get builds for

  • complete (boolean) – if not None, filters results based on completeness

  • resultSpec – result spec containing filters sorting and paging requests from data/REST API. If possible, the db layer can optimize the SQL query using this information.

Returns:

list of build dictionaries as above, via Deferred

Get a list of builds, in the format described above. Each of the parameters limits the resulting set of builds.

addBuild(builderid, buildrequestid, workerid, masterid, state_string)
Parameters:
  • builderid (integer) – builder to get builds for

  • buildrequestid (integer) – build request id

  • workerid (integer) – worker performing the build

  • masterid (integer) – master performing the build

  • state_string (unicode) – initial state of the build

Returns:

tuple of build ID and build number, via Deferred

Add a new build to the db, recorded as having started at the current time. This will invent a new number for the build, unique within the context of the builder.

setBuildStateString(buildid, state_string):
Parameters:
  • buildid (integer) – build id

  • state_string (unicode) – updated state of the build

Returns:

Deferred

Update the state strings for the given build.

finishBuild(buildid, results)
Parameters:
  • buildid (integer) – build id

  • results (integer) – build result

Returns:

Deferred

Mark the given build as finished, with complete_at set to the current time.

Note

This update is done unconditionally, even if the build is already finished.

getBuildProperties(buildid, resultSpec=None)
Parameters:
  • buildid – build ID

  • resultSpec – resultSpec

Returns:

dictionary mapping property name to value, source, via Deferred

Return the properties for a build, in the same format they were given to addBuild. Optional filtering via resultSpec is available and optimized in the db layer.

Note that this method does not distinguish a non-existent build from a build with no properties, and returns {} in either case.

setBuildProperty(buildid, name, value, source)
Parameters:
  • buildid (integer) – build ID

  • name (string) – Name of the property to set

  • value – Value of the property

  • source (string) – Source of the Property to set

Returns:

Deferred

Set a build property. If no property with that name existed in that build, a new property will be created.

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

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

发布评论

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