diff options
-rw-r--r-- | buildbot_gentoo_ci/config/reporters.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/buildbot_gentoo_ci/config/reporters.py b/buildbot_gentoo_ci/config/reporters.py index 54472b0..ede9178 100644 --- a/buildbot_gentoo_ci/config/reporters.py +++ b/buildbot_gentoo_ci/config/reporters.py @@ -1,6 +1,8 @@ # Copyright 2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +from twisted.internet import defer + from buildbot.plugins import util from buildbot.reporters.gitlab import GitLabStatusPush from buildbot.reporters.generators.build import BuildStatusGenerator, BuildStartEndStatusGenerator @@ -42,9 +44,24 @@ irc_reporter = irc.IRCStatusPush("irc.libera.chat", "gci_test", noticeOnChannel=True ) #gitlab +@util.renderer +@defer.inlineCallbacks +def getGitlabContext(props): + context = None + gentooci = props.master.namedServices['services'].namedServices['gentooci'] + if props.getProperty('buildername') == 'update_v_data': + context = 'Update database and check ebuild' + if props.getProperty('buildername') == 'run_build_request': + project_data = yield gentooci.db.projects.getProjectByUuid(props.getProperty('project_uuid')) + context = f"Project/{project_data['description']}/Build" + if props.getProperty('buildername') == 'parse_build_log': + project_data = yield gentooci.db.projects.getProjectByUuid(props.getProperty('project_build_data')['project_uuid']) + context = f"Project/{project_data['description']}/Check Log" + return context def gitlabGenerators(): builders = [ - #'run_build_request', + 'update_v_data', + 'run_build_request', 'parse_build_log' ] return [ @@ -53,7 +70,7 @@ def gitlabGenerators(): ) ] gitlab_gentoo_org = GitLabStatusPush(token=util.Secret("gitlabToken"), - #context= util.Interpolate('Buildbot %(prop:buildername)s'), + context= getGitlabContext, baseURL='https://gitlab.gentoo.org', generators=gitlabGenerators(), #debug=True, |