1
0
Fork 0

Bug 1568466 - part 1: Make .taskcluster.yml support action hooks

master
Johan Lorenzo 2019-11-28 14:49:34 +01:00 committed by Sebastian Kaspari
parent f85961d9a9
commit cb1cd1e4c7
1 changed files with 211 additions and 190 deletions

View File

@ -63,8 +63,11 @@ tasks:
$if: 'tasks_for == "github-release"'
then: '${event.release.target_commitish}'
else:
$if: 'tasks_for in ["cron", "action"]'
$if: 'tasks_for == "cron"'
then: '${push.branch}'
else:
$if: 'tasks_for == "action"'
then: ${parameters.head_ref}
head_sha:
$if: 'tasks_for == "github-push"'
then: '${event.after}'
@ -75,18 +78,21 @@ tasks:
$if: 'tasks_for == "github-release"'
then: '${event.release.tag_name}'
else:
$if: 'tasks_for in ["cron", "action"]'
$if: 'tasks_for == "cron"'
then: '${push.revision}'
else:
$if: 'tasks_for == "action"'
then: ${parameters.head_rev}
head_tag:
$if: 'tasks_for == "github-release"'
then: '${event.release.tag_name}'
else: ''
ownTaskId:
$if: '"github" in tasks_for'
then: {$eval: as_slugid("decision_task")}
else:
$if: 'tasks_for == "cron"'
$if: 'tasks_for in ["cron", "action"]'
then: '${ownTaskId}'
releaseAction:
$if: 'tasks_for == "github-release"'
@ -102,9 +108,16 @@ tasks:
$if: 'tasks_for in ["github-push", "github-release", "action", "cron"] && repoUrl == "https://github.com/mozilla-mobile/fenix"'
then: '3'
else: '1'
short_head_branch:
$if: 'head_branch[:11] == "refs/heads/"'
then: {$eval: 'head_branch[11:]'}
in:
$mergeDeep:
- $if: 'tasks_for != "action"'
then:
taskId: '${ownTaskId}'
taskGroupId:
- taskGroupId:
$if: 'tasks_for == "action"'
then:
'${action.taskGroupId}'
@ -145,22 +158,26 @@ tasks:
then:
kind: cron-task
routes:
$flatten:
$flattenDeep:
- checks
- $if: 'level == "3"'
then:
- "tc-treeherder.v2.${project}.${head_sha}"
else: []
- tc-treeherder.v2.${project}.${head_sha}
# TODO Bug 1601928: Make this scope fork-friendly once ${project} is better defined. This will enable
# staging release promotion on forks.
- $if: 'tasks_for == "github-push"'
then:
- index.project.mobile.${project}.v2.branch.${short_head_branch}.latest.taskgraph.decision
- index.project.mobile.${project}.v2.branch.${short_head_branch}.revision.${head_sha}.taskgraph.decision
- $if: 'tasks_for == "cron"'
then:
- index.project.mobile.${project}.v2.branch.${short_head_branch}.latest.taskgraph.decision-${cron.job_name}
- index.project.mobile.${project}.v2.branch.${short_head_branch}.revision.${head_sha}.taskgraph.decision-${cron.job_name}
- index.project.mobile.${project}.v2.branch.${short_head_branch}.revision.${head_sha}.taskgraph.cron.${ownTaskId}
scopes:
# `https://` is 8 characters so, ${repoUrl[8:]} is the repository without the protocol.
$if: 'tasks_for == "github-push"'
then:
$let:
short_head_branch:
$if: 'head_branch[:11] == "refs/heads/"'
then: {$eval: 'head_branch[11:]'}
else: ${head_branch}
in:
# `https://` is 8 characters so, ${repoUrl[8:]} is the repository without the protocol.
- 'assume:repo:${repoUrl[8:]}:branch:${short_head_branch}'
else:
$if: 'tasks_for == "github-pull-request"'
@ -209,6 +226,9 @@ tasks:
ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
ACTION_INPUT: {$json: {$eval: 'input'}}
ACTION_CALLBACK: '${action.cb_name}'
- $if: 'tasks_for == "github-release"'
then:
MOBILE_HEAD_TAG: '${event.release.tag_name}'
features:
taskclusterProxy: true
chainOfTrust: true
@ -232,9 +252,10 @@ tasks:
in:
$if: 'tasks_for == "action"'
then: >
cd /builds/worker/checkouts/src &&
PIP_IGNORE_INSTALLED=0 pip install --user /builds/worker/checkouts/taskgraph &&
taskcluster/scripts/install-sdk.sh &&
ln -s /builds/worker/artifacts artifacts &&
taskgraph action-callback
~/.local/bin/taskgraph action-callback
else: >
PIP_IGNORE_INSTALLED=0 pip install --user /builds/worker/checkouts/taskgraph &&
PIP_IGNORE_INSTALLED=0 pip install --user arrow taskcluster pyyaml &&