From b4468a689d2f773047c4ff604cfd26351f02e190 Mon Sep 17 00:00:00 2001 From: "Ben Hearsum (he/him)" Date: Wed, 17 May 2023 13:57:46 -0400 Subject: [PATCH] Allow Taskcluster to run on `dev-` branches; add Treeherder symbols for decision and action tasks (#120) * Enable dev branches; add treeherder symbols for non-level 3 decision/action tasks. * Drop base ref/rev to make pushes to non-main branches work * Don't add treeherder symbols for pull requests (treeherder doesn't work for them anyways...) * Use isPullRequest to determine whether or not something is a pull request for the purpose of skipping treeherder routes * Only build dev- branches for staging repository --- .taskcluster.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 94fb279bd..91e41d1f9 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -37,22 +37,11 @@ tasks: 'tasks_for == "github-push"': ${event.ref} 'tasks_for == "github-release"': '${event.release.target_commitish}' 'tasks_for in ["action", "cron"]': '${push.branch}' - base_ref: - $switch: - 'tasks_for[:19] == "github-pull-request"': ${event.pull_request.base.ref} - 'tasks_for == "github-push" && event.base_ref': ${event.base_ref} - 'tasks_for == "github-push"': ${event.ref} - 'tasks_for in ["cron", "action"]': '${push.branch}' head_ref: $switch: 'tasks_for[:19] == "github-pull-request"': ${event.pull_request.head.ref} 'tasks_for == "github-push"': ${event.ref} 'tasks_for in ["cron", "action"]': '${push.branch}' - base_sha: - $switch: - 'tasks_for == "github-push"': '${event.before}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.base.sha}' - 'tasks_for in ["cron", "action"]': '${push.revision}' head_sha: $switch: 'tasks_for == "github-push"': '${event.after}' @@ -71,7 +60,7 @@ tasks: in: $if: > tasks_for in ["action", "cron"] - || (tasks_for == "github-push" && head_branch == "refs/heads/main") + || (tasks_for == "github-push" && (head_branch == "refs/heads/main" || (repoUrl == "https://github.com/mozilla-releng/staging-firefox-translations-training" && head_branch[:15] == "refs/heads/dev-"))) || (isPullRequest && pullRequestAction in ["opened", "reopened", "synchronize"]) then: $let: @@ -126,7 +115,7 @@ tasks: routes: $flatten: - checks - - $if: 'level == "3"' + - $if: '!isPullRequest' then: - tc-treeherder.v2.${project}.${head_sha} - $switch: @@ -184,8 +173,6 @@ tasks: # `taskgraph decision` are all on the command line. $merge: - ${normProjectUpper}_BASE_REPOSITORY: '${baseRepoUrl}' - ${normProjectUpper}_BASE_REF: '${base_ref}' - ${normProjectUpper}_BASE_REV: '${base_sha}' ${normProjectUpper}_HEAD_REPOSITORY: '${repoUrl}' ${normProjectUpper}_HEAD_REF: '${head_ref}' ${normProjectUpper}_HEAD_REV: '${head_sha}' @@ -239,8 +226,6 @@ tasks: --repository-type=git --tasks-for='${tasks_for}' --base-repository='${baseRepoUrl}' - --base-ref='${base_ref}' - --base-rev='${base_sha}' --head-repository='${repoUrl}' --head-ref='${head_ref}' --head-rev='${head_sha}'