From c2b4c0b7a2128bb6826cb038d0b36ed0ea49d4a1 Mon Sep 17 00:00:00 2001 From: Ben Hearsum Date: Thu, 28 Nov 2024 19:40:24 -0500 Subject: [PATCH] eval --- .taskcluster.yml | 96 +++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 4db625b9e..40393dfc5 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -13,74 +13,78 @@ tasks: trustDomain: "translations" ownerEmail: $switch: - 'tasks_for == "github-push"': '${event.pusher.email}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.user.login}@users.noreply.github.com' - 'tasks_for in ["cron", "action", "pr-action"]': '${tasks_for}@noreply.mozilla.org' + 'tasks_for == "github-push"': {$eval: 'event.pusher.email'} + 'tasks_for[:19] == "github-pull-request"': {$eval: '{event.pull_request.user.login}@users.noreply.github.com'} + + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: '{tasks_for}@noreply.mozilla.org'} baseRepoUrl: $switch: - 'tasks_for == "github-push"': '${event.repository.html_url}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.base.repo.html_url}' - 'tasks_for in ["cron", "action"]': '${repository.url}' - 'tasks_for == "pr-action"': '${repository.base_url}' + 'tasks_for == "github-push"': {$eval: 'event.repository.html_url'} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.base.repo.html_url'} + 'tasks_for in ["cron", "action"]': {$eval: 'repository.url'} + 'tasks_for == "pr-action"': {$eval: 'repository.base_url'} repoUrl: $switch: - 'tasks_for == "github-push"': '${event.repository.html_url}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.head.repo.html_url}' - 'tasks_for in ["cron", "action", "pr-action"]': '${repository.url}' + 'tasks_for == "github-push"': {$eval: 'event.repository.html_url'} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.head.repo.html_url'} + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: 'repository.url'} project: $switch: - 'tasks_for == "github-push"': '${event.repository.name}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.head.repo.name}' - 'tasks_for in ["cron", "action", "pr-action"]': '${repository.project}' + 'tasks_for == "github-push"': {$eval: 'event.repository.name'} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.head.repo.name'} + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: 'repository.project'} head_branch: $switch: - 'tasks_for[:19] == "github-pull-request"': ${event.pull_request.head.ref} - 'tasks_for == "github-push"': ${event.ref} - 'tasks_for == "github-release"': '${event.release.target_commitish}' - 'tasks_for in ["action", "cron", "pr-action"]': '${push.branch}' + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.head.ref'} + 'tasks_for == "github-push"': {$eval: 'event.ref'} + 'tasks_for == "github-release"': {$eval: 'event.release.target_commitish'} + 'tasks_for in ["action", "cron", "pr-action"]': {$eval: '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}' - 'tasks_for == "pr-action"': '${push.base_branch}' + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.base.ref'} + 'tasks_for == "github-push"': + $if: {$eval: 'event.base_ref'} + then: {$eval: 'event.base_ref'} + else: {$eval: 'event.ref'} + 'tasks_for in ["cron", "action"]': {$eval: 'push.branch'} + 'tasks_for == "pr-action"': {$eval: 'push.base_branch'} + $default: {$eval: 'tasks_for'} 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", "pr-action"]': '${push.branch}' + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.head.ref'} + 'tasks_for == "github-push"': {$eval: 'event.ref'} + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: '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", "pr-action"]': '${push.revision}' + 'tasks_for == "github-push"': {$eval: 'event.before'} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.base.sha'} + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: 'push.revision'} head_sha: $switch: - 'tasks_for == "github-push"': '${event.after}' - 'tasks_for[:19] == "github-pull-request"': '${event.pull_request.head.sha}' - 'tasks_for in ["cron", "action", "pr-action"]': '${push.revision}' + 'tasks_for == "github-push"': {$eval: 'event.after'} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.pull_request.head.sha'} + 'tasks_for in ["cron", "action", "pr-action"]': {$eval: 'push.revision'} ownTaskId: $switch: '"github" in tasks_for': {$eval: as_slugid("decision_task")} - 'tasks_for in ["cron", "action"]': '${ownTaskId}' + 'tasks_for in ["cron", "action"]': {$eval: 'ownTaskId'} pullRequestAction: $switch: - 'tasks_for[:19] == "github-pull-request"': ${event.action} + 'tasks_for[:19] == "github-pull-request"': {$eval: 'event.action'} $default: 'UNDEFINED' isPullRequest: $eval: 'tasks_for[:19] == "github-pull-request"' in: $let: short_base_ref: - $if: 'base_ref[:11] == "refs/heads/"' + $if: {$eval: 'base_ref[:11] == "refs/heads/"'} then: {$eval: 'base_ref[11:]'} - else: ${base_ref} + else: {$eval: 'base_ref'} short_head_ref: - $if: 'head_ref[:11] == "refs/heads/"' + $if: {$eval: 'head_ref[:11] == "refs/heads/"'} then: {$eval: 'head_ref[11:]'} - else: ${head_ref} + else: {$eval: 'head_ref'} in: $if: > tasks_for in ["action", "pr-action", "cron"] @@ -97,7 +101,7 @@ tasks: '${action.taskGroupId}' else: '${ownTaskId}' # same as taskId; this is how automation identifies a decision task - schedulerId: '${trustDomain}-level-${level}' + schedulerId: sched created: {$fromNow: ''} deadline: {$fromNow: '1 day'} expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first @@ -124,7 +128,7 @@ tasks: name: "Decision Task for cron job ${cron.job_name}" description: 'Created by a [cron task](https://firefox-ci-tc.services.mozilla.com/tasks/${cron.task_id})' - provisionerId: "${trustDomain}-${level}" + provisionerId: prov workerType: "decision-gcp" tags: @@ -146,15 +150,15 @@ tasks: - tc-treeherder.v2.${project}.${head_sha} - $switch: 'tasks_for == "github-push"': - - "index.${trustDomain}.v2.${project}.latest.taskgraph.decision" - - "index.${trustDomain}.v2.${project}.revision.${head_sha}.taskgraph.decision" + - "index.trusty.v2.${project}.latest.taskgraph.decision" + - "index.trusty.v2.${project}.revision.${head_sha}.taskgraph.decision" 'tasks_for == "action"': - - "index.${trustDomain}.v2.${project}.revision.${head_sha}.taskgraph.actions.${ownTaskId}" + - "index.trusty.v2.${project}.revision.${head_sha}.taskgraph.actions.${ownTaskId}" 'tasks_for == "cron"': - - "index.${trustDomain}.v2.${project}.latest.taskgraph.decision-${cron.job_name}" - - "index.${trustDomain}.v2.${project}.revision.${head_sha}.taskgraph.decision-${cron.job_name}" + - "index.trusty.v2.${project}.latest.taskgraph.decision-${cron.job_name}" + - "index.trusty.v2.${project}.revision.${head_sha}.taskgraph.decision-${cron.job_name}" # list each cron task on this revision, so actions can find them - - 'index.${trustDomain}.v2.${project}.revision.${head_sha}.cron.${ownTaskId}' + - 'index.trusty.v2.${project}.revision.${head_sha}.cron.${ownTaskId}' $default: [] scopes: @@ -221,7 +225,7 @@ tasks: ACTION_CALLBACK: '${action.cb_name}' cache: - "${trustDomain}-level-${level}-checkouts-sparse-v2": /builds/worker/checkouts + "trusty-level-${level}-checkouts-sparse-v2": /builds/worker/checkouts features: taskclusterProxy: true