zuul-web: add pipelines' manager, triggers data in status

The /api/tenant/{tenant}/status includes information about
pipelines' type (ie manager) and triggers drivers.

Change-Id: I6abe4bdcf175426908c321a2a298b9743f5ea80b
This commit is contained in:
Matthieu Huin
2021-09-23 16:07:32 +02:00
parent 0cfd75d7ef
commit f215ad80c0
6 changed files with 11 additions and 1 deletions

View File

@@ -155,6 +155,8 @@ class TestWeb(BaseTestWeb):
self.assertEqual(p["trigger_events"], 0)
self.assertEqual(p["result_events"], 0)
self.assertEqual(p["management_events"], 0)
self.assertIn('manager', p, p)
self.assertTrue(len(p.get('triggers', [])) > 0, p)
for q in p['change_queues']:
if p['name'] in ['gate', 'conflict']:
self.assertEqual(q['window'], 20)

View File

@@ -24,6 +24,7 @@ class DependentPipelineManager(SharedQueuePipelineManager):
reparenting algorithm for handling errors.
"""
changes_merge = True
type = 'dependent'
def __init__(self, *args, **kwargs):
super(DependentPipelineManager, self).__init__(*args, **kwargs)

View File

@@ -19,6 +19,7 @@ class IndependentPipelineManager(PipelineManager):
"""PipelineManager that puts every Change into its own ChangeQueue."""
changes_merge = False
type = 'independent'
def _postConfig(self, layout):
super(IndependentPipelineManager, self)._postConfig(layout)

View File

@@ -18,6 +18,7 @@ class SerialPipelineManager(SharedQueuePipelineManager):
"""PipelineManager with shared queues and a window of 1"""
changes_merge = False
type = 'serial'
def constructChangeQueue(self, queue_name):
return model.ChangeQueue.new(

View File

@@ -19,6 +19,7 @@ class SupercedentPipelineManager(PipelineManager):
"""PipelineManager with one queue per project and a window of 1"""
changes_merge = False
type = 'supercedent'
def getChangeQueue(self, change, event, existing=None):
log = get_annotated_logger(self.log, event)

View File

@@ -459,7 +459,11 @@ class Pipeline(object):
def formatStatusJSON(self, websocket_url=None):
j_pipeline = dict(name=self.name,
description=self.description,
state=self.state.state)
state=self.state.state,
manager=self.manager.type)
j_pipeline['triggers'] = [
{'driver': t.driver.name} for t in self.triggers
]
j_queues = []
j_pipeline['change_queues'] = j_queues
for queue in self.queues: