From c40e648417d8d9705f5fdf36d2c4adbe684d7121 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Tue, 9 Nov 2021 23:33:55 +0000 Subject: [PATCH] Bug 1740381 - Port bug 1736565 (Infer artifact build candidate tree based on version) for comm- trees. r=nalexander This is the same configuration as for mozilla- trees as added in https://hg.mozilla.org/mozilla-central/rev/93e421a84361 except Thunderbird doesn't use comm-release. Differential Revision: https://phabricator.services.mozilla.com/D130817 --- python/mozbuild/mozbuild/artifacts.py | 13 +++++-- .../mozbuild/mozbuild/test/test_artifacts.py | 36 +++++++++++++++++-- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py index 64933c8e575d..442efa320d88 100644 --- a/python/mozbuild/mozbuild/artifacts.py +++ b/python/mozbuild/mozbuild/artifacts.py @@ -762,9 +762,16 @@ class ThunderbirdMixin(object): product = "thunderbird" try_tree = "try-comm-central" - @property - def candidate_trees(self): - return ["comm-central"] + nightly_candidate_trees = [ + "comm-central", + ] + beta_candidate_trees = [ + "releases/comm-beta", + ] + # The list below list should be updated when we have new ESRs. + esr_candidate_trees = [ + "releases/comm-esr91", + ] class LinuxThunderbirdArtifactJob(ThunderbirdMixin, LinuxArtifactJob): diff --git a/python/mozbuild/mozbuild/test/test_artifacts.py b/python/mozbuild/mozbuild/test/test_artifacts.py index f473fc81091d..a10721ef7029 100644 --- a/python/mozbuild/mozbuild/test/test_artifacts.py +++ b/python/mozbuild/mozbuild/test/test_artifacts.py @@ -70,9 +70,41 @@ class FakeThunderbirdJob(ThunderbirdMixin, FakeArtifactJob): class TestThunderbirdMixin(TestCase): - def test_candidate_trees(self): + def _assert_candidate_trees(self, version_display, expected_trees): + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = version_display + job = FakeThunderbirdJob() - self.assertEqual(job.candidate_trees, ["comm-central"]) + self.assertGreater(len(job.candidate_trees), 0) + self.assertEqual(job.candidate_trees, expected_trees) + + def test_candidate_trees_with_beta_version(self): + self._assert_candidate_trees( + version_display="92.1b2", + expected_trees=ThunderbirdMixin.beta_candidate_trees, + ) + + def test_candidate_trees_with_esr_version(self): + self._assert_candidate_trees( + version_display="91.3.0esr", + expected_trees=ThunderbirdMixin.esr_candidate_trees, + ) + + def test_candidate_trees_with_nightly_version(self): + self._assert_candidate_trees( + version_display="95.0a1", + expected_trees=ThunderbirdMixin.nightly_candidate_trees, + ) + + def test_property_is_cached(self): + job = FakeThunderbirdJob() + expected_trees = ThunderbirdMixin.esr_candidate_trees + + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = "91.3.0.esr" + self.assertEqual(job.candidate_trees, expected_trees) + # Because the property is cached, changing the + # `MOZ_APP_VERSION_DISPLAY` won't have any impact. + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = "" + self.assertEqual(job.candidate_trees, expected_trees) if __name__ == "__main__":