Add item UUID to MQTT reporter

Since the MQTT reporter can be used to emit start or enqueue events,
it may be useful to match enqueue and dequeue events.  That could
be done with tenant+pipeline+change+patchset, but we also have a
UUID for queue items, so to make it simpler for MQTT consumers,
let's expose that.

Change-Id: Iff88bcfd73e00f292e0cc947f548582a276a7975
This commit is contained in:
James E. Blair 2021-06-18 15:07:18 -07:00
parent 0a5e330891
commit 3fbd61c0d5
3 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,12 @@ An MQTT report uses this schema:
.. attr:: <mqtt schema>
.. attr:: uuid
The item UUID. Each item enqueued into a Zuul pipeline is
assigned a UUID which remains the same even as Zuul's
speculative execution algorithm re-orders pipeline contents.
.. attr:: action
The reporter action name, e.g.: 'start', 'success', 'failure',

View File

@ -652,6 +652,7 @@ class TestMQTTConnection(ZuulTestCase):
self.assertIn('enqueue_time', mqtt_payload)
self.assertIn('trigger_time', mqtt_payload)
self.assertIn('zuul_event_id', mqtt_payload)
self.assertIn('uuid', mqtt_payload)
self.assertEquals(dependent_test_job['dependencies'], ['test'])
def test_mqtt_invalid_topic(self):

View File

@ -48,6 +48,7 @@ class MQTTReporter(BaseReporter):
item, with_jobs=False),
'trigger_time': item.event.timestamp,
'enqueue_time': item.enqueue_time,
'uuid': item.uuid,
'buildset': {
'uuid': item.current_build_set.uuid,
'result': item.current_build_set.result,