From 25ac3feb284428dd88eab70b915bcea04aa9b52b Mon Sep 17 00:00:00 2001 From: Benjamin Schanzel Date: Wed, 16 Oct 2019 10:13:51 +0200 Subject: [PATCH] Provide zuul_event_id in MQTT Report Message When trying to trace logs of builds it is often useful to search for log messages via the event id of a specific build. The event id is printed in (nearly) all log messages but is not provided by the MQTT reporter, so one has to look it up first based on the build id. To circumvent this extra step and make searching the logs more straight forward, this patch makes sure the event id is provided in the JSON message by the MQTT reporter. Change-Id: I908dd7eca250825eed97bf8261fd33b69cc5f543 --- tests/unit/test_connection.py | 1 + zuul/driver/mqtt/mqttreporter.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/unit/test_connection.py b/tests/unit/test_connection.py index a3ffed06bb..2adc98f448 100644 --- a/tests/unit/test_connection.py +++ b/tests/unit/test_connection.py @@ -492,6 +492,7 @@ class TestMQTTConnection(ZuulTestCase): self.assertIn('timestamp', mqtt_payload) self.assertIn('enqueue_time', mqtt_payload) self.assertIn('trigger_time', mqtt_payload) + self.assertIn('zuul_event_id', mqtt_payload) self.assertEquals(dependent_test_job['dependencies'], ['test']) def test_mqtt_invalid_topic(self): diff --git a/zuul/driver/mqtt/mqttreporter.py b/zuul/driver/mqtt/mqttreporter.py index f5ab6e4a5e..fd7f6d30fa 100644 --- a/zuul/driver/mqtt/mqttreporter.py +++ b/zuul/driver/mqtt/mqttreporter.py @@ -49,6 +49,7 @@ class MQTTReporter(BaseReporter): 'uuid': item.current_build_set.uuid, 'builds': [] }, + 'zuul_event_id': item.event.zuul_event_id, } for job in item.getJobs(): job_informations = {