From 9ce52fc2148a930916180b6ebd227ac1c58124c8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 14 2018 09:36:22 +0000 Subject: Mention the commit tested in the flag added This way it becomes easier to see the difference between different flags. Signed-off-by: Pierre-Yves Chibon --- diff --git a/simple_koji_ci/consumers.py b/simple_koji_ci/consumers.py index af862dc..a9c99cf 100644 --- a/simple_koji_ci/consumers.py +++ b/simple_koji_ci/consumers.py @@ -176,6 +176,8 @@ class SimpleKojiCi(fedmsg.consumers.FedmsgConsumer): package = msg['msg']['pullrequest']['project']['name'] namespace = msg['msg']['pullrequest']['project']['namespace'] branch_to = msg['msg']['pullrequest']['branch'] + commit = msg['msg']['pullrequest'].get('commit_stop') + commit_label = ' for %s' % commit[:8] if commit else '' try: _log.info('Kicking a scratch build for ' + str(package)) @@ -187,8 +189,11 @@ class SimpleKojiCi(fedmsg.consumers.FedmsgConsumer): # Map that koji task_id to the pull-request we want to flag self.scratch_builds[task_id] = dict( - prid=prid, name=package, namespace=namespace, + prid=prid, + name=package, + namespace=namespace, uid=uid + commit=commit, ) # Flag the PR that the build is in progress @@ -196,7 +201,14 @@ class SimpleKojiCi(fedmsg.consumers.FedmsgConsumer): data = { 'username': 'simple-koji-ci', 'status': 'pending', - 'comment': 'Build in progress', + 'comment': 'Build in progress%s' % commit_label, + 'url': koji_url, + } + + self._flag_pr(task_id, koji_url, data) + + except Exception as e: + _log.exception(e) 'url': koji_url, } @@ -247,10 +259,12 @@ class SimpleKojiCi(fedmsg.consumers.FedmsgConsumer): return koji_url = _koji_link(msg) + commit = self.scratch_builds[task_id].get('commit') + commit_label = ' for %s' % commit[:8] if commit else '' data = { 'username': 'simple-koji-ci', 'status': 'success' if state == 'CLOSED' else 'failure', - 'comment': 'Build %s' % done_states[state], + 'comment': 'Build %s%s' % (done_states[state], commit_label), 'url': koji_url, }