scheduler: return project_canonical in status page

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

Change-Id: Icebb4f065d4f2df478e801873ff9abead01b0aa8
This commit is contained in:
Tristan Cacqueray 2018-07-13 05:53:39 +00:00 committed by Matthieu Huin
parent c2c5ce26bf
commit 2f1260c2f9
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'):