Skip to content

Commit

Permalink
Merge 02df791 into d6f8607
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLorenzo committed Jul 29, 2019
2 parents d6f8607 + 02df791 commit 1373c4b
Showing 1 changed file with 105 additions and 20 deletions.
125 changes: 105 additions & 20 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,108 @@ version: 1
policy:
pullRequests: public
tasks:
- schedulerId: taskcluster-github
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
expires: {$fromNow: '1 year'}
provisionerId: aws-provisioner-v1
workerType: github-worker
retries: 5
payload:
maxRunTime: 600
image: python:3.7-slim
command:
- /bin/bash
- --login
- -cx
- exit 0
metadata:
owner: JohanLorenzo@users.noreply.github.com
source: https://github.com/mozilla-releng/mozilla-version/pull/65
name: 'mozilla-version - noop'
description: 'noop task while https://github.com/mozilla-releng/mozilla-version/pull/64 lands'
$let:
expires_in: {$fromNow: '1 year'}
user: ${event.sender.login}

# 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}

github_repository_full_name:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.base.repo.full_name}
else: ${event.repository.full_name}

in:
$let:
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:
schedulerId: taskcluster-github
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
expires: ${expires_in}
provisionerId: aws-provisioner-v1
workerType: github-worker
retries: 5
payload:
maxRunTime: 600 # Decision should remain fast enough to schedule a handful of tasks
image: mozillamobile/fenix:1.4
command:
- /bin/bash
- --login
- -cx
- >-
pip install tox &&
tox -e "$TOXENV"
env:
SKIP_NETWORK_TESTS: "0"
metadata:
owner: ${user}@users.noreply.github.com
source: ${repository}/raw/${head_rev}/.taskcluster.yml
in:
$flatten:
$map:
- short_name: 'py27'
image_tag: '2.7'
- short_name: 'py36'
image_tag: '3.6'
- short_name: 'py37'
image_tag: '3.7'
each(params):
$let:
python_task_definition:
payload:
image: python:${params.image_tag}
env:
TOX_ENV: ${params.short_name}
in:
- $if: 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "edited", "synchronize"]'
then:
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'python_task_definition'}
- scopes:
- ${assume_scope_prefix}:pull-request
metadata:
name: 'mozilla-version - ${params.short_name} (Pull Request #${event.pull_request.number})'
description: 'Triggered by [#${event.pull_request.number}](${event.pull_request.html_url})'
- $if: 'tasks_for == "github-push" && head_branch[:10] != "refs/tags/"'
then:
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'python_task_definition'}
- scopes:
- ${assume_scope_prefix}:branch:${short_head_branch}
metadata:
name: 'mozilla-version - ${params.short_name} (${head_rev})'
description: 'Triggered by ${head_rev}'

0 comments on commit 1373c4b

Please sign in to comment.