forked from mozilla-releng/k8s-autoscale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.taskcluster.yml
130 lines (123 loc) · 4.23 KB
/
.taskcluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
version: 1
policy:
pullRequests: public
tasks:
$let:
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}
repo_url:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.repo.html_url}
else: ${event.repository.html_url}
owner: ${event.sender.login}@users.noreply.github.com
push_docker_image:
$if: 'tasks_for == "github-pull-request"'
then: '0'
else:
$if: 'tasks_for == "github-push" && event.ref in ["refs/heads/master", "refs/heads/production"]'
then: '1'
else: '0'
docker_tag:
$if: 'tasks_for == "github-pull-request"'
then: pull-request
else:
$if: 'tasks_for == "github-release"'
then: ${event.release.tag_name}
else: # push
$if: 'event.ref == "refs/heads/production"'
then: production
else:
$if: 'event.ref == "refs/heads/master"'
# Use the `:dev` docker tag for master pushes for the "nonprod" K8S
# cluster. It matches the scriptworkers' docker image naming schema.
then: dev
else: unknown
worker_level:
$if: 'tasks_for == "github-pull-request"'
then: 't'
else:
$if: 'tasks_for == "github-push" && event.ref in ["refs/heads/master", "refs/heads/production"]'
then: '3'
else: 't'
in:
$if: >
(tasks_for == "github-pull-request" && event.action in ["opened", "reopened", "synchronize"])
|| tasks_for == "github-push"
then:
- taskId: '${as_slugid("py311")}'
provisionerId: releng-t
workerType: linux-gcp
created: {$fromNow: ''}
deadline: {$fromNow: '4 hours'}
payload:
maxRunTime: 3600
image: python:3.11
command:
- sh
- -lxce
- >-
git clone ${repo_url} /src &&
cd /src &&
git config advice.detachedHead false &&
git checkout ${head_rev} &&
pip install tox &&
tox -e py311
metadata:
name: tox py311 (${docker_tag})
description: code linting & unit tests on py311 (${docker_tag})
owner: ${owner}
source: ${repo_url}/raw/${head_rev}/.taskcluster.yml
- taskId: {$eval: as_slugid("docker-build-and-push")}
dependencies:
- '${as_slugid("py311")}'
created: {$fromNow: ''}
deadline: {$fromNow: '24 hours'}
provisionerId: 'releng-${worker_level}'
workerType: linux-gcp
routes: []
payload:
maxRunTime: 3600
# we need to run really old docker version because taskcluster is using
# really old version in their setup
# image: docker:stable
image: 'docker:1.6.2'
env:
DOCKERHUB_EMAIL: '[email protected]'
DOCKERHUB_USER: 'mozillarelengservices'
DOCKER_REPO: 'mozilla/releng-k8s-autoscale'
DOCKER_TAG: '${docker_tag}'
GIT_HEAD_REV: '${head_rev}'
PUSH_DOCKER_IMAGE: '${push_docker_image}'
REPO_URL: '${repo_url}'
SECRET_URL: 'http://taskcluster/secrets/v1/secret/project/releng/k8s-autoscale/deploy'
command:
- sh
- -lxce
- >-
cd /tmp &&
wget ${repo_url}/archive/${head_rev}.tar.gz &&
tar zxf ${head_rev}.tar.gz &&
find . &&
mv k8s-autoscale-${head_rev} /src &&
cd /src &&
./docker.d/generate_version_json.sh &&
./docker.d/build_image.sh &&
./docker.d/push_image.sh
features:
dind: true
taskclusterProxy: true
scopes:
$if: 'push_docker_image == "0"'
then: []
else:
- secrets:get:project/releng/k8s-autoscale/deploy
metadata:
name: k8s-autoscale docker build (${docker_tag})
description: k8s-autoscale docker build (${docker_tag})
owner: ${owner}
source: ${repo_url}