From f8a6622f5d8cc1f8773956d6db6e81ad7fd05261 Mon Sep 17 00:00:00 2001
From: Johan Lorenzo <jlorenzo@mozilla.com>
Date: Mon, 8 Aug 2022 11:15:08 +0200
Subject: [PATCH] Bug 1782736 - part 3: Stop scheduling a decision task on
 Github Releases

now that Android releases are kicked off through ShipIt
---
 .taskcluster.yml | 68 ++++++++++++++----------------------------------
 1 file changed, 19 insertions(+), 49 deletions(-)

diff --git a/.taskcluster.yml b/.taskcluster.yml
index a69df33590f..663be7f211f 100644
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -20,12 +20,9 @@ tasks:
                       else:
                           $if: 'tasks_for == "github-pull-request"'
                           then: '${event.pull_request.user.login}@users.noreply.github.com'
-                          else:
-                              $if: 'tasks_for == "github-release"'
-                              then: '${event.sender.login}@users.noreply.github.com'
 
           baseRepoUrl:
-              $if: 'tasks_for in ["github-push", "github-release"]'
+              $if: 'tasks_for == "github-push"'
               then: '${event.repository.html_url}'
               else:
                   $if: 'tasks_for == "github-pull-request"'
@@ -34,7 +31,7 @@ tasks:
                       $if: 'tasks_for in ["cron", "action"]'
                       then: '${repository.url}'
           repoUrl:
-              $if: 'tasks_for in ["github-push", "github-release"]'
+              $if: 'tasks_for == "github-push"'
               then: '${event.repository.html_url}'
               else:
                   $if: 'tasks_for == "github-pull-request"'
@@ -43,7 +40,7 @@ tasks:
                       $if: 'tasks_for in ["cron", "action"]'
                       then: '${repository.url}'
           project:
-              $if: 'tasks_for in ["github-push", "github-release"]'
+              $if: 'tasks_for == "github-push"'
               then: '${event.repository.name}'
               else:
                   $if: 'tasks_for == "github-pull-request"'
@@ -58,11 +55,8 @@ tasks:
                   $if: 'tasks_for == "github-push"'
                   then: ${event.ref}
                   else:
-                      $if: 'tasks_for == "github-release"'
-                      then: '${event.release.target_commitish}'
-                      else:
-                          $if: 'tasks_for in ["cron", "action"]'
-                          then: '${push.branch}'
+                      $if: 'tasks_for in ["cron", "action"]'
+                      then: '${push.branch}'
           base_sha:
               $if: 'tasks_for == "github-push"'
               then: '${event.before}'
@@ -77,16 +71,8 @@ tasks:
                   $if: 'tasks_for == "github-pull-request"'
                   then: '${event.pull_request.head.sha}'
                   else:
-                      $if: 'tasks_for == "github-release"'
-                      then: '${event.release.tag_name}'
-                      else:
-                          $if: 'tasks_for in ["cron", "action"]'
-                          then: '${push.revision}'
-          head_tag:
-              $if: 'tasks_for == "github-release"'
-              then: '${event.release.tag_name}'
-              else: ''
-
+                      $if: 'tasks_for in ["cron", "action"]'
+                      then: '${push.revision}'
           ownTaskId:
               $if: '"github" in tasks_for'
               then: {$eval: as_slugid("decision_task")}
@@ -98,21 +84,15 @@ tasks:
               $if: 'tasks_for == "github-pull-request"'
               then: ${event.action}
               else: 'UNDEFINED'
-
-          releaseAction:
-              $if: 'tasks_for == "github-release"'
-              then: ${event.action}
-              else: 'UNDEFINED'
       in:
           $if: >
             tasks_for in ["action", "cron"]
             || (tasks_for == "github-pull-request" && pullRequestAction in ["opened", "reopened", "synchronize"])
             || (tasks_for == "github-push" && head_branch[:10] != "refs/tags/" && head_branch != "staging.tmp" && head_branch != "trying.tmp") && (head_branch[:8] != "mergify/")
-            || (tasks_for == "github-release" && releaseAction == "published" && ownerEmail[:21] != "moz-releng-automation")
           then:
               $let:
                   level:
-                      $if: 'tasks_for in ["github-push", "github-release", "action", "cron"] && repoUrl == "https://github.com/mozilla-mobile/firefox-android"'
+                      $if: 'tasks_for in ["github-push", "action", "cron"] && repoUrl == "https://github.com/mozilla-mobile/firefox-android"'
                       then: '3'
                       else: '1'
 
@@ -138,7 +118,7 @@ tasks:
                             $merge:
                                 - owner: "${ownerEmail}"
                                   source: '${repoUrl}/raw/${head_sha}/.taskcluster.yml'
-                                - $if: 'tasks_for in ["github-push", "github-pull-request", "github-release"]'
+                                - $if: 'tasks_for in ["github-push", "github-pull-request"]'
                                   then:
                                       name: "Decision Task"
                                       description: 'The task that creates all of the other tasks in the task graph'
@@ -194,16 +174,12 @@ tasks:
                                 then:
                                     - 'assume:repo:github.com/${event.pull_request.base.repo.full_name}:pull-request'
                                 else:
-                                    $if: 'tasks_for == "github-release"'
+                                    $if: 'tasks_for == "action"'
                                     then:
-                                        - 'assume:repo:${repoUrl[8:]}:release'
+                                        # when all actions are hooks, we can calculate this directly rather than using a variable
+                                        - '${action.repo_scope}'
                                     else:
-                                        $if: 'tasks_for == "action"'
-                                        then:
-                                            # when all actions are hooks, we can calculate this directly rather than using a variable
-                                            - '${action.repo_scope}'
-                                        else:
-                                            - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
+                                        - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
 
                         requires: all-completed
                         priority: lowest
@@ -219,7 +195,6 @@ tasks:
                                       MOBILE_HEAD_REPOSITORY: '${repoUrl}'
                                       MOBILE_HEAD_REF: '${head_branch}'
                                       MOBILE_HEAD_REV: '${head_sha}'
-                                      MOBILE_HEAD_TAG: '${head_tag}'
                                       MOBILE_PIP_REQUIREMENTS: taskcluster/requirements.txt
                                       MOBILE_REPOSITORY_TYPE: git
                                       MOZ_AUTOMATION: "1"
@@ -274,7 +249,6 @@ tasks:
                                           --head-repository="$MOBILE_HEAD_REPOSITORY"
                                           --head-ref="$MOBILE_HEAD_REF"
                                           --head-rev="$MOBILE_HEAD_REV"
-                                          --head-tag="$MOBILE_HEAD_TAG"
                                           --repository-type="$MOBILE_REPOSITORY_TYPE"
                                           --tasks-for='${tasks_for}'
                                           ${extraArgs}
@@ -303,18 +277,14 @@ tasks:
                                             then:
                                                 symbol: D
                                             else:
-                                                $if: 'tasks_for == "github-release"'
+                                                $if: 'tasks_for == "action"'
                                                 then:
-                                                    symbol: 'ship_android_components'
+                                                    groupName: 'action-callback'
+                                                    groupSymbol: AC
+                                                    symbol: "${action.symbol}"
                                                 else:
-                                                    $if: 'tasks_for == "action"'
-                                                    then:
-                                                        groupName: 'action-callback'
-                                                        groupSymbol: AC
-                                                        symbol: "${action.symbol}"
-                                                    else:
-                                                        groupSymbol: cron
-                                                        symbol: "${cron.job_symbol}"
+                                                    groupSymbol: cron
+                                                    symbol: "${cron.job_symbol}"
                                 - $if: 'tasks_for == "action"'
                                   then:
                                       parent: '${action.taskGroupId}'
-- 
GitLab