Skip to content

Commit

Permalink
Allow Taskcluster to run on dev- branches; add Treeherder symbols f…
Browse files Browse the repository at this point in the history
…or decision and action tasks (mozilla#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
  • Loading branch information
bhearsum authored May 17, 2023
1 parent cd169ef commit b4468a6
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand All @@ -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:
Expand Down Expand Up @@ -126,7 +115,7 @@ tasks:
routes:
$flatten:
- checks
- $if: 'level == "3"'
- $if: '!isPullRequest'
then:
- tc-treeherder.v2.${project}.${head_sha}
- $switch:
Expand Down Expand Up @@ -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}'
Expand Down Expand Up @@ -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}'
Expand Down

0 comments on commit b4468a6

Please sign in to comment.