From bd5c5ef653f2987005603a756d395a0b8d277797 Mon Sep 17 00:00:00 2001 From: Rob Lemley Date: Tue, 18 Apr 2023 19:36:49 +0000 Subject: [PATCH] Bug 1827709: Notify Thunderbird CI Matrix channel after mozilla-central push. r=releng-reviewers,gabriel This notification will help Thunderbird developers who are tasked with pushing multiple bugs to comm-central after a mozilla-central push. Taskgraph tests adjusted to verify the notification is only sent for pushes to mozilla-central, and to run the tests when .taskcluster.yml is updated. Differential Revision: https://phabricator.services.mozilla.com/D175290 --- .taskcluster.yml | 29 ++++++++++++------- taskcluster/ci/source-test/python.yml | 1 + .../test/test_taskcluster_yml.py | 25 ++++++++++++++++ 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 2539b33956de..381d02969590 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -131,7 +131,11 @@ tasks: # Send a notification email if the push comes from try - $if: 'repository.project == "try"' then: - "notify.email.${ownerEmail}.on-completed" + - "notify.email.${ownerEmail}.on-completed" + - $if: 'repository.project == "mozilla-central"' + then: + # Notify #thunderbird-ci + - "notify.matrix-room.!TWztIhgqLawNpRBZTC:mozilla.org.on-completed" else: $if: 'tasks_for == "action"' then: @@ -310,13 +314,16 @@ tasks: - $if: 'tasks_for == "hg-push"' then: notify: - email: - $merge: - - link: - text: "Treeherder Jobs" - href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}" - # Email for try pushes should thank you for your revision - - $if: 'repository.project == "try"' - then: - subject: "Thank you for your try submission of ${push.revision}. It's the best!" - content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs." + $merge: + - email: + $merge: + - link: + text: "Treeherder Jobs" + href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}" + - $if: 'repository.project == "try"' + then: + subject: "Thank you for your try submission of ${push.revision}. It's the best!" + content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs." + - $if: 'repository.project == "mozilla-central"' + then: + matrixBody: "${repository.project} push notification: https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}" diff --git a/taskcluster/ci/source-test/python.yml b/taskcluster/ci/source-test/python.yml index bcc41ce94109..63671086bdf4 100644 --- a/taskcluster/ci/source-test/python.yml +++ b/taskcluster/ci/source-test/python.yml @@ -45,6 +45,7 @@ firefox-ci: subsuite: ci when: files-changed: + - '.taskcluster.yml' - 'taskcluster/ci/**' - 'taskcluster/**/*.py' - 'tools/tryselect/selectors/auto.py' diff --git a/taskcluster/gecko_taskgraph/test/test_taskcluster_yml.py b/taskcluster/gecko_taskgraph/test/test_taskcluster_yml.py index 49a87381f70b..cdf94ec3e126 100644 --- a/taskcluster/gecko_taskgraph/test/test_taskcluster_yml.py +++ b/taskcluster/gecko_taskgraph/test/test_taskcluster_yml.py @@ -41,6 +41,31 @@ class TestTaskclusterYml(unittest.TestCase): self.assertEqual( rendered["tasks"][0]["metadata"]["name"], "Gecko Decision Task" ) + self.assertIn("matrixBody", rendered["tasks"][0]["extra"]["notify"]) + + def test_push_non_mc(self): + context = { + "tasks_for": "hg-push", + "push": { + "revision": "e8d2d9aff5026ef1f1777b781b47fdcbdb9d8f20", + "base_revision": "e8aebe488b2f2e567940577de25013d00e818f7c", + "owner": "dustin@mozilla.com", + "pushlog_id": 1556565286, + "pushdate": 112957, + }, + "repository": { + "url": "https://hg.mozilla.org/releases/mozilla-beta", + "project": "mozilla-beta", + "level": "3", + }, + "ownTaskId": slugid.nice(), + } + rendered = jsone.render(self.taskcluster_yml, context) + pprint.pprint(rendered) + self.assertEqual( + rendered["tasks"][0]["metadata"]["name"], "Gecko Decision Task" + ) + self.assertNotIn("matrixBody", rendered["tasks"][0]["extra"]["notify"]) def test_cron(self): context = {