Browse Source

scheduler: return project_canonical in status page

This change fix zuul-changes.py usage when there are ambiguous project names.

Change-Id: Icebb4f065d4f2df478e801873ff9abead01b0aa8
changes/51/582451/5
Tristan Cacqueray 3 years ago
committed by Matthieu Huin
parent
commit
2f1260c2f9
  1. 3
      tests/unit/test_web.py
  2. 2
      tools/zuul-changes.py
  3. 2
      zuul/model.py

3
tests/unit/test_web.py

@ -124,6 +124,9 @@ class TestWeb(BaseTestWeb):
self.assertEqual(q['window'], 0)
for head in q['heads']:
for change in head:
self.assertIn(
'review.example.com/org/project',
change['project_canonical'])
self.assertTrue(change['active'])
self.assertIn(change['id'], ('1,1', '2,1', '3,1'))
for job in change['jobs']:

2
tools/zuul-changes.py

@ -53,6 +53,6 @@ for pipeline in data['pipelines']:
"--pipeline %s --project %s --change %s,%s" % (
options.tenant,
options.pipeline,
change['project'],
change['project_canonical'],
cid, cps)
)

2
zuul/model.py

@ -2230,11 +2230,13 @@ class QueueItem(object):
ret['zuul_ref'] = self.current_build_set.ref
if self.change.project:
ret['project'] = self.change.project.name
ret['project_canonical'] = self.change.project.canonical_name
else:
# For cross-project dependencies with the depends-on
# project not known to zuul, the project is None
# Set it to a static value
ret['project'] = "Unknown Project"
ret['project_canonical'] = "Unknown Project"
ret['enqueue_time'] = int(self.enqueue_time * 1000)
ret['jobs'] = []
if hasattr(self.change, 'owner'):

Loading…
Cancel
Save