commit:     eb2f05efcf0392a17894233de29b5c3ede8e1b43
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  6 22:27:24 2024 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Jan  6 22:27:24 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=eb2f05ef

Add getGitlabContext to Gitlab status

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/config/reporters.py | 21 +++++++++++++++++++--
 1 file 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
[email protected]
[email protected]
+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,

Reply via email to