Merge "scheduler: return project_canonical in status page"

This commit is contained in:
Zuul 2018-07-27 23:34:35 +00:00 committed by Gerrit Code Review
commit 8e011f597e
3 changed files with 6 additions and 1 deletions

3
tests/unit/test_web.py Normal file → Executable file
View File

@ -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']:

View File

@ -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)
)

View File

@ -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'):