Skip to content

Commit

Permalink
buildbot: Send build request to buildbot on NewReleaseVersion event
Browse files Browse the repository at this point in the history
  • Loading branch information
OatmealDome committed Apr 20, 2024
1 parent 7c8130a commit ce873d9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions central/buildbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ def make_dev_build_request(branch, rev, shortrev, who, comment):
}


def make_release_build_request(tag, rev, who):
comment = "Release %s" % tag

return {
"branch": "refs/tags/%s" % tag,
"who": who,
"revision": rev,
"comments": comment,
"properties": json.dumps(
{
"branchname": "releases",
"shortrev": tag,
"author": who,
"description": comment,
}
),
}


def send_build_request(build_request):
"""Stores the build request via the buildbot change hook API."""
requests.post(
Expand Down Expand Up @@ -304,6 +323,18 @@ def push_event(self, evt):
send_build_request(req)


class NewReleaseVersionListener(events.EventTarget):
def __init__(self):
super().__init__()

def accept_event(self, evt):
return evt.type == events.NewReleaseVersion.TYPE

def push_event(self, evt):
req = make_release_build_request(evt.tag, evt.hash, evt.author)
send_build_request(req)


def start():
"""Starts all the Buildbot related services."""

Expand All @@ -318,3 +349,4 @@ def start():
utils.DaemonThread(target=collector.run).start()

events.dispatcher.register_target(NewDevVersionListener())
events.dispatcher.register_target(NewReleaseVersionListener())

0 comments on commit ce873d9

Please sign in to comment.