From fb4cfb1cb7d29af66fd885a939fc19ab20ef7d30 Mon Sep 17 00:00:00 2001 From: Johan Lorenzo Date: Thu, 4 Jul 2019 10:54:58 +0200 Subject: [PATCH] Do not put Treeherder route when on untrusted repo (#2921) --- .taskcluster.yml | 8 ++++++-- automation/taskcluster/lib/tasks.py | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 8ee9fc564..d56ca507d 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -77,8 +77,12 @@ tasks: requires: all-completed # Must be explicit because of Chain of Trust retries: 5 routes: - - statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust - - tc-treeherder.v2.fenix.${head_rev} + $flatten: + - statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust + - $if: 'trust_level == 3' + then: + - tc-treeherder.v2.fenix.${head_rev} + else: [] payload: maxRunTime: 600 # Decision should remain fast enough to schedule a handful of tasks image: mozillamobile/fenix:1.4 diff --git a/automation/taskcluster/lib/tasks.py b/automation/taskcluster/lib/tasks.py index 424720f99..d47a8f33e 100644 --- a/automation/taskcluster/lib/tasks.py +++ b/automation/taskcluster/lib/tasks.py @@ -362,6 +362,9 @@ class TaskBuilder(object): deadline = taskcluster.fromNow('1 day') expires = taskcluster.fromNow(DEFAULT_EXPIRES_IN) + if self.trust_level == 3: + routes.append('tc-treeherder.v2.fenix.{}'.format(self.commit)) + return { "provisionerId": provisioner_id, "workerType": worker_type, @@ -375,9 +378,7 @@ class TaskBuilder(object): "priority": self.tasks_priority, "dependencies": [self.task_id] + dependencies, "requires": "all-completed", - "routes": routes + [ - "tc-treeherder.v2.fenix.{}".format(self.commit) - ], + "routes": routes, "scopes": scopes, "payload": payload, "extra": {