From 2f1260c2f9fda51b8cf1f035b3d84aba8299e2d4 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 13 Jul 2018 05:53:39 +0000 Subject: [PATCH] scheduler: return project_canonical in status page This change fix zuul-changes.py usage when there are ambiguous project names. Change-Id: Icebb4f065d4f2df478e801873ff9abead01b0aa8 --- tests/unit/test_web.py | 3 +++ tools/zuul-changes.py | 2 +- zuul/model.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 tests/unit/test_web.py diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py old mode 100644 new mode 100755 index a6b36e365e..b4278802ed --- a/tests/unit/test_web.py +++ b/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']: diff --git a/tools/zuul-changes.py b/tools/zuul-changes.py index 8db576b269..45bd4de16b 100755 --- a/tools/zuul-changes.py +++ b/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) ) diff --git a/zuul/model.py b/zuul/model.py index 04a8c9ae1c..baf6022a96 100644 --- a/zuul/model.py +++ b/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'):