2019-01-08 00:58:02 +00:00
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
version : 1
policy :
2019-08-28 19:16:04 +00:00
# XXX We restrict taskcluster to collaborators so priviledged tests (like UI tests) can run on PRs
pullRequests : collaborators
2019-01-08 00:58:02 +00:00
tasks :
2019-03-19 17:24:53 +00:00
$let :
decision_task_id : {$eval : as_slugid("decision_task")}
expires_in : {$fromNow : '1 year' }
user : ${event.sender.login}
2019-08-02 13:36:11 +00:00
project_name : fenix
2019-03-19 17:24:53 +00:00
# We define the following variable at the very top, because they are used in the
# default definition
head_branch :
$if : 'tasks_for == "github-pull-request"'
then : ${event.pull_request.head.ref}
else :
$if : 'tasks_for == "github-push"'
then : ${event.ref}
else : ${event.release.target_commitish}
head_rev :
$if : 'tasks_for == "github-pull-request"'
then : ${event.pull_request.head.sha}
else :
$if : 'tasks_for == "github-push"'
then : ${event.after}
else : ${event.release.tag_name}
repository :
$if : 'tasks_for == "github-pull-request"'
then : ${event.pull_request.head.repo.html_url}
else : ${event.repository.html_url}
scheduler_id :
$if : 'tasks_for == "cron"'
then: focus-nightly-sched # TODO : Rename to mobile-nightly-sched
else : taskcluster-github
2019-02-07 13:50:46 +00:00
2019-03-19 17:24:53 +00:00
github_repository_full_name :
$if : 'tasks_for == "github-pull-request"'
then : ${event.pull_request.base.repo.full_name}
else : ${event.repository.full_name}
2019-02-07 13:50:46 +00:00
2019-04-02 11:56:45 +00:00
trust_level :
2019-03-19 17:24:53 +00:00
# Pull requests on main repository can't be trusted because anybody can open a PR on it, without a review
2019-05-09 11:46:34 +00:00
$if : 'tasks_for in ["github-push", "github-release", "cron"] && event.repository.html_url == "https://github.com/mozilla-mobile/fenix"'
2019-04-02 11:56:45 +00:00
then : 3
else : 1
2019-03-19 17:24:53 +00:00
in :
$let :
# TODO: revisit once bug 1533314 is done to possibly infer better priorities
tasks_priority : highest
short_head_branch :
$if : 'head_branch[:10] == "refs/tags/"'
then : {$eval : 'head_branch[10:]' }
else :
$if : 'head_branch[:11] == "refs/heads/"'
then : {$eval : 'head_branch[11:]' }
else : ${head_branch}
assume_scope_prefix : assume:repo:github.com/${github_repository_full_name}
in :
$let :
default_task_definition :
taskId : ${decision_task_id}
taskGroupId : ${decision_task_id} # Must be explicit because of Chain of Trust
schedulerId : ${scheduler_id}
created : {$fromNow : '' }
deadline : {$fromNow : '2 hours' }
expires : ${expires_in}
provisionerId : aws-provisioner-v1
2019-04-02 11:56:45 +00:00
workerType : mobile-${trust_level}-decision
2019-03-19 17:24:53 +00:00
priority : ${tasks_priority}
requires : all-completed # Must be explicit because of Chain of Trust
retries : 5
routes :
2019-07-04 08:54:58 +00:00
$flatten :
- statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust
- $if : 'trust_level == 3'
then :
2019-08-02 13:36:11 +00:00
- tc-treeherder.v2.${project_name}.${head_rev}
2019-07-04 08:54:58 +00:00
else : [ ]
2019-03-19 17:24:53 +00:00
payload :
maxRunTime : 600 # Decision should remain fast enough to schedule a handful of tasks
2019-08-02 13:36:11 +00:00
image : mozillamobile/${project_name}:1.4
2019-03-19 17:24:53 +00:00
command :
- /bin/bash
- --login
- -cx
# The rest of the command must be defined below
env :
2019-03-28 10:44:23 +00:00
BUILD_DATE : ${now}
2019-03-19 17:24:53 +00:00
MOBILE_HEAD_BRANCH : ${head_branch}
2019-03-28 10:44:23 +00:00
MOBILE_HEAD_REPOSITORY : ${repository}
2019-03-19 17:24:53 +00:00
MOBILE_HEAD_REV : ${head_rev}
2019-03-27 11:06:59 +00:00
MOBILE_TRIGGERED_BY : ${user}
2019-03-28 10:44:23 +00:00
SCHEDULER_ID : ${scheduler_id}
2019-04-02 13:53:23 +00:00
SHORT_HEAD_BRANCH : ${short_head_branch}
2019-03-28 10:44:23 +00:00
TASK_ID : ${decision_task_id}
TASKS_PRIORITY : ${tasks_priority}
2019-04-02 11:56:45 +00:00
TRUST_LEVEL : ${trust_level}
2019-03-19 17:24:53 +00:00
features :
2019-04-05 14:21:51 +00:00
chainOfTrust : true
2019-03-19 17:24:53 +00:00
taskclusterProxy : true
2019-04-05 14:21:51 +00:00
artifacts :
public/task-graph.json :
type : file
2019-08-02 13:36:11 +00:00
path : /opt/${project_name}/task-graph.json
2019-04-05 14:21:51 +00:00
expires : ${expires_in}
public/actions.json :
type : file
2019-08-02 13:36:11 +00:00
path : /opt/${project_name}/actions.json
2019-04-05 14:21:51 +00:00
expires : ${expires_in}
public/parameters.yml :
type : file
2019-08-02 13:36:11 +00:00
path : /opt/${project_name}/parameters.yml
2019-04-05 14:21:51 +00:00
expires : ${expires_in}
2019-03-19 17:24:53 +00:00
extra :
tasks_for : ${tasks_for}
2019-03-27 14:23:03 +00:00
treeherder :
machine :
platform : mobile-decision
2019-03-19 17:24:53 +00:00
metadata :
owner : ${user}@users.noreply.github.com
source : ${repository}/raw/${head_rev}/.taskcluster.yml
2019-01-08 00:58:02 +00:00
in :
2019-05-27 15:31:06 +00:00
$flatten :
2019-07-19 18:21:03 +00:00
- $if : 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "edited", "synchronize"]'
2019-05-27 15:31:06 +00:00
then :
$let :
pull_request_title : ${event.pull_request.title}
pull_request_number : ${event.pull_request.number}
pull_request_url : ${event.pull_request.html_url}
in :
$mergeDeep :
- {$eval : 'default_task_definition' }
- scopes :
- ${assume_scope_prefix}:pull-request
payload :
command :
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout FETCH_HEAD
2019-08-05 16:10:05 +00:00
&& python automation/taskcluster/decision_task.py pull-request
2019-05-27 15:31:06 +00:00
env :
GITHUB_PULL_TITLE : ${pull_request_title}
2019-07-19 14:58:14 +00:00
MOBILE_PULL_REQUEST_NUMBER : ${pull_request_number}
2019-05-27 15:31:06 +00:00
extra :
treeherder :
symbol : D-PR
metadata :
2019-08-02 13:36:11 +00:00
name : '${project_name} - Decision task (Pull Request #${pull_request_number})'
description : 'Building and testing ${project_name} - triggered by [#${pull_request_number}](${pull_request_url})'
2019-05-27 15:31:06 +00:00
- $if : 'tasks_for == "github-push" && head_branch[:10] != "refs/tags/"'
then :
2019-04-05 14:21:51 +00:00
$mergeDeep :
- {$eval : 'default_task_definition' }
- scopes :
2019-05-27 15:31:06 +00:00
- ${assume_scope_prefix}:branch:${short_head_branch}
2019-04-05 14:21:51 +00:00
payload :
command :
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout FETCH_HEAD
2019-05-27 15:31:06 +00:00
&& python automation/taskcluster/decision_task.py push
2019-04-05 14:21:51 +00:00
extra :
treeherder :
2019-05-27 15:31:06 +00:00
symbol : D
2019-04-05 14:21:51 +00:00
metadata :
2019-08-02 13:36:11 +00:00
name : ${project_name} VCS-Push Decision task
description : Schedules the build and test tasks for ${project_name}.
2019-05-27 15:31:06 +00:00
- $if : 'tasks_for == "github-release" && event["action"] == "published"'
then :
$mergeDeep :
- {$eval : 'default_task_definition' }
- scopes :
- ${assume_scope_prefix}:release
payload :
2019-03-27 14:23:03 +00:00
command :
- >-
2019-05-27 15:31:06 +00:00
git fetch ${repository} refs/tags/${head_rev}
2019-03-27 14:23:03 +00:00
&& git config advice.detachedHead false
2019-04-05 14:21:51 +00:00
&& git checkout FETCH_HEAD
2019-06-10 15:55:21 +00:00
&& python automation/taskcluster/decision_task.py github-release ${event.release.tag_name}
2019-05-27 15:31:06 +00:00
extra :
treeherder :
2019-06-10 15:55:21 +00:00
symbol : D-github-release
2019-05-27 15:31:06 +00:00
metadata :
2019-08-02 13:36:11 +00:00
name : ${project_name} Github Release Decision Task
description : Building and releasing ${project_name} ${event.release.tag_name}
2019-05-27 15:31:06 +00:00
- $if : 'tasks_for == "cron"'
then :
$let :
staging_flag :
$if : 'trust_level == 3'
then : ''
else : '--staging'
in :
- $if : 'cron.name == "nightly"'
then :
$mergeDeep :
- {$eval : 'default_task_definition' }
- scopes :
- $if : 'trust_level == 3'
2019-08-02 13:36:11 +00:00
then : assume:hook-id:project-mobile/${project_name}-nightly
else : assume:hook-id:project-mobile/${project_name}-nightly-staging
2019-05-27 15:31:06 +00:00
routes :
$if : 'trust_level == 3'
then :
- notify.email.fenix-eng-notifications@mozilla.com.on-failed
payload :
command :
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout FETCH_HEAD
&& python automation/taskcluster/decision_task.py nightly ${staging_flag}
extra :
cron : {$json : {$eval : 'cron' }}
treeherder :
symbol : nightly-D
metadata :
2019-08-02 13:36:11 +00:00
name : ${project_name} Nightly Decision Task
2019-05-27 15:31:06 +00:00
description : Decision task scheduled by cron task [${cron.task_id}](https://tools.taskcluster.net/tasks/${cron.task_id})
- $if : 'cron.name == "raptor"'
then :
$mergeDeep :
- {$eval : 'default_task_definition' }
- scopes :
- $if : 'trust_level == 3'
2019-08-02 13:36:11 +00:00
then : assume:hook-id:project-mobile/${project_name}-raptor
else : assume:hook-id:project-mobile/${project_name}-raptor-staging
2019-05-27 15:31:06 +00:00
routes :
$if : 'trust_level == 3'
then :
- notify.email.fenix-eng-notifications@mozilla.com.on-failed
2019-08-02 13:41:10 +00:00
- notify.email.perftest-alerts@mozilla.com.on-failed
2019-05-27 15:31:06 +00:00
payload :
command :
- >-
git fetch ${repository} ${head_branch}
&& git config advice.detachedHead false
&& git checkout FETCH_HEAD
&& python automation/taskcluster/decision_task.py raptor ${staging_flag}
extra :
cron : {$json : {$eval : 'cron' }}
treeherder :
symbol : raptor-D
2019-08-02 13:41:10 +00:00
notify :
email :
link :
text : Treeherder Job
href : "https://treeherder.mozilla.org/#/jobs?repo=${project_name}&revision=${head_rev}"
subject : "[${project_name}] Raptor decision task failed"
content : "This calls for an action of the development team. If needed, escalate to the release engineering team in #releaseduty-mobile on Slack. Use the link to view it on Treeherder."
2019-05-27 15:31:06 +00:00
metadata :
2019-08-02 13:36:11 +00:00
name : ${project_name} Raptor Decision Task
2019-05-27 15:31:06 +00:00
description : Decision task scheduled by cron task [${cron.task_id}](https://tools.taskcluster.net/tasks/${cron.task_id})