简体   繁体   中英

Cancel build request in buildbot 1.2.0

In order to use buildbot to trigger different actions (start, check, stop) and cancel build requests based on the status of an event (Implements the threading.Event interface based on a file) we were using the nextBuild property of buildbot.plugins.util.BuilderConfig ( http://docs.buildbot.net/latest/manual/cfg-builders.html ):

BuilderConfig(...,
              nextBuild=partial(handle_property_action_for_next_build, event))

So based on the action (start, stop, check) and the status of the event we would cancel all requests with cancelBuildRequest:

def handle_property_action_for_next_build(event, _, requests):
    action = requests[0].properties.getProperty("action")

    if action == "start":
        if event.is_set():
            for request in requests:
                request.cancelBuildRequest()
            return None
        else:
            event.set()

But the cancelBuildRequest method was removed some time ago: https://github.com/buildbot/buildbot/commit/95b90d7f0881dd4891199b16be9af2242729081b#diff-e55fd5266f5206f358b6da23011e41f0

So the question is how would I cancel a build request with buildbot 1.2.0?

It doesn't need to be in the nextBuild attribute but somewhere where I have:

  1. Access to current action
  2. Can pass the custom event
  3. Can cancel the build request

使用数据API:

request.master.data.control("cancel", ("buildrequests", request.id))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM