From c8b965bde6ebf185bae03f1227fc6b955da8913f Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 26 Apr 2017 17:01:25 -0400 Subject: [PATCH] Add source_url to mqtt payload This commit adds the source_url to the mqtt payload for events emitted by the subunit worker. Just the build_uuid isn't enough to figure out what's going on because we typically do 2 events for each uuid, one with a .gz extension and the other not. We need to distinguish between the 2 to figure out what's actually going on. Change-Id: I56f0b9fb1128b412cd88e49164eb91c3e9e3e4cb --- files/subunit-gearman-worker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/subunit-gearman-worker.py b/files/subunit-gearman-worker.py index 8b6ed32..ab5c72b 100644 --- a/files/subunit-gearman-worker.py +++ b/files/subunit-gearman-worker.py @@ -111,6 +111,7 @@ class SubunitRetriever(object): def _handle_event(self): fields = {} + source_url = '' job = self.gearman_worker.getJob() try: arguments = json.loads(job.arguments.decode('utf-8')) @@ -138,6 +139,7 @@ class SubunitRetriever(object): if self.mqtt: msg = json.dumps({ 'build_uuid': out_event.get('build_uuid'), + 'source_url': source_url, 'status': 'success', }) self.mqtt.publish_single(msg, out_event.get('project'), @@ -148,6 +150,7 @@ class SubunitRetriever(object): if self.mqtt: msg = json.dumps({ 'build_uuid': fields.get('build_uuid'), + 'source_url': source_url, 'status': 'failed', }) self.mqtt.publish_single(msg, fields.get('project'),