forked from apache/openserverless-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
338 lines (302 loc) · 8.33 KB
/
Taskfile.yml
File metadata and controls
338 lines (302 loc) · 8.33 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
version: "3"
vars:
# CLOUD: gcp
CLOUD: azure
DOMAIN: opstest.top
REF:
sh: date +%Y.%m%d.%H%S
dotenv:
- .env
includes:
aws: ./TaskfileAWS.yml
gcp: ./TaskfileGCloud.yml
azure: ./TaskfileAzure.yml
tasks:
default: task --list-all
setup: { silent: true }
status:
cmds:
- ops config use
- ops debug info
toggle-support:
desc: enable/disable support
cmds:
- |
if test -e support
then git rm -f support
else touch support ; git add support
fi
kind:create:
cmds:
- which docker
- ops config minimal
- ops setup devcluster
kind:delete:
- ops setup devcluster --uninstall
update_op:
silent: false
cmds:
- |
if test -n "$OP_SERVICE_ACCOUNT_TOKEN"; then
op item edit "{{.OP_ITEM}}" "{{.KEY}}={{.VALUE}}" --vault "{{.OP_VAULT}}"
fi
requires:
vars: [ KEY, VALUE ]
k3s:create:
cmds:
- task: "{{.CLOUD}}:vm:create"
vars:
ARCH: x86
NAME: k3s-test
TYPE: k3s
- task: "{{.CLOUD}}:vm:getip"
vars:
VM_NAME: k3s-test
- task: "{{.CLOUD}}:zone:update"
vars:
HOST: k3s.{{.DOMAIN}}
IP: $(cat _ip)
- task: update_op
vars:
KEY: K3S_IP
VALUE: $(cat _ip)
k3s:delete:
cmds:
- task: "{{.CLOUD}}:vm:delete"
vars:
ARCH: x86
NAME: k3s-test
k3s:arm:create:
cmds:
- task: "{{.CLOUD}}:vm:create"
vars:
ARCH: arm
NAME: k3s-arm-test
TYPE: k3s
- task: "{{.CLOUD}}:vm:getip"
vars:
VM_NAME: k3s-arm-test
- task: "{{.CLOUD}}:zone:update"
vars:
HOST: k3s-arm.{{.DOMAIN}}
IP: $(cat _ip)
- task: update_op
vars:
KEY: K3S_ARM_IP
VALUE: $(cat _ip)
k3s:arm:delete:
cmds:
- task: "{{.CLOUD}}:vm:delete"
vars:
ARCH: arm
NAME: k3s-arm-test
mk8s:create:
cmds:
- task: "{{.CLOUD}}:vm:create"
vars:
ARCH: x86
NAME: mk8s-test
TYPE: mk8s
- task: "{{.CLOUD}}:vm:getip"
vars:
VM_NAME: mk8s-test
- task: "{{.CLOUD}}:zone:update"
vars:
HOST: mk8s.{{.DOMAIN}}
IP: $(cat _ip)
- task: update_op
vars:
KEY: MK8S_IP
VALUE: $(cat _ip)
mk8s:delete:
cmds:
- task: "{{.CLOUD}}:vm:delete"
vars:
NAME: mk8s-test
TYPE: mk8s
#
## TODO: to be verified
#osh:create:
# cmds:
# - mkdir -p conf/{{.CLOUD}}
# - cp conf/{{.CLOUD}}-install-config.yaml conf/{{.CLOUD}}/install-config.yaml
# - openshift-install create cluster --dir conf/{{.CLOUD}}
# - nuv cloud osh import conf/{{.CLOUD}}/auth/kubeconfig
# - nuv cloud osh setup
# - nuv config use openshift --rename=openshift-nuvolaris-testing
#
## TODO: to be verified
#osh:delete:
# - openshift-install destroy cluster --dir conf/{{.CLOUD}}
#
## TODO: to be verified
#eks:create:
# cmds:
# - task aws:cluster:create
# - nuv cloud eks lb >_cname
# - nuv cloud aws zone-update eks.opstest.top --wildcard --cname=$(cat _cname)
#
## TODO: to be verified
#eks:delete:
# cmds:
# - task aws:cluster:delete
#
## TODO: to be verified
#aks:create:
# cmds:
# - task azure:cluster:create
# - ops cloud aks lb >_ip
# - ops cloud azcloud zone-update aks.opstest.top --wildcard --ip $(cat _ip)
#
## TODO: to be verified
#aks:delete:
# cmds:
# - task azure:cluster:delete
# --> DISABLED - secrets are taken from 1PASSWORD
#upload-secrets:
# cmds:
# - |
# if ! test -e .secrets
# then echo "please setup .env and generate secrets with task secrets before"
# exit 1
# fi
# - |
# for i in $(awk -F= '{print $1}' <.secrets)
# do echo "uploading $i"
# gh -R openserverless/openserverless-testing secret set "$i" -b "${!i}"
# done
# --> DISABLED - ip are taken from 1PASSWORD
# upload secrets to access to vm
# prereq: ssh key in ~/.ssh/id_rsa
# two vm created with k3s:create and mk8s:create
#secrets-vm: |
# K3S_IP=$(ops cloud gcloud vm-getip k3s-test)
# echo K3S_IP=$K3S_IP >>.secrets
# MK8S_IP=$(ops cloud gcloud vm-getip mk8s-test)
# echo MK8S_IP=$MK8S_IP >>.secrets
# --> DISABLED - kubeconfigs are taken from 1PASSWORD
# upload secrets to access to kubernetes clusters
# prereq: eks:create aks:create gke:create openshift:create
# kubernetes configs stored in ~/.nuv
#secrets-kube: |
# for i in aks eks gke openshift
# do
# f="$i-nuvolaris-testing"
# nuv config use $f
# nuv debug kubeconfig
# VAR="$(echo $i | tr 'a-z-' 'A-Z_')_KUBECONFIG_B64"
# DATA="$(cat ~/.kube/config | base64 -w0)"
# echo "Secret $VAR:"
# echo "$VAR=\"$DATA\"" >>.secrets
# done
# here you need
# ssh key in ~/.ssh/id_rsa
# gloud service account in ~/.ssh/gcloud.json
# DISABLED
#secrets-id:
# - |
# ID_RSA_B64="$(cat ~/.ssh/id_rsa | base64 -w0)"
# echo ID_RSA_B64=$ID_RSA_B64 >>.secrets
# - |
# echo AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID >>.secrets
# echo AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY >>.secrets
# - |
# GCLOUD_SERVICE_ACCOUNT_B64="$(cat ~/.ssh/gcloud.json | base64 -w0)"
# echo GCLOUD_SERVICE_ACCOUNT_B64=\"$GCLOUD_SERVICE_ACCOUNT_B64\" >>.secrets
# --> DISABLED - secrets are taken from 1PASSWORD
#secrets:
# cmds:
# - echo SKIP_SSL=true >.secrets
# - task: gcp:vm:config
# - task: secrets-id
# - task: secrets-vm
# - task: secrets-kube
# OK
test-ci:
requires: {vars: [N, REF]}
cmds:
- |
git tag -d $(git tag)
git tag {{.N}}-{{.REF}}
git commit -m "triggening {{.N}} for ref {{.REF}}" || true
git push --tags
# OK (kind)
d: task test-ci N=kind
# OK (k3s)
k: task test-ci N=k3s
# OK (k3s-arm)
r: task test-ci N=k3s-arm
# OK (mk8s)
m: task test-ci N=mk8s
# OK (eks)
e: task test-ci N=eks
# OK (aks)
a: task test-ci N=aks
# TODO: to be verified
g: task test-ci N=gke
# TODO: to be verified
o: task test-ci N=osh
all:
ignore_error: true
cmds:
- |
cd tasks
gh pr create --title="Tentative merge for $TASKS" --body "Merge this if all [*-$OLARIS](https://github.com/apache/openserverless-testing/actions) tests succeed."
- task d k m e a g
tag-test-ci: |
git tag {{.TAG}}
git push origin --tags
# TODO: to be verified
config:
cmds:
#- task aws:vm:config
#- task aws:cluster:config
#- task gcp:vm:config
#- task gcp:cluster:config
#- task azure:vm:config
login:
- az login --use-device-code
- gcloud auth login
- gcloud config set project openserverless-testing
# TODO: to be verified
vmconfig:
silent: true
cmds:
- echo $ID_RSA_B64 | base64 -d >conf/id_rsa
- chmod 0600 conf/id_rsa
- |
eval $(ssh-agent -s)
ssh-add conf/id_rsa
ops cloud k3s kubeconfig api.k3s.opstest.top ubuntu
ops cloud mk8s kubeconfig api.mk8s.opstest.top ubuntu
# TODO: to be verified
kubeconfig:
- task: config
- task: login
- task: vmconfig
- echo "eks kubeconfig"
- ops cloud eks kubeconfig
- echo "gke kubeconfig"
- ops cloud gke kubeconfig
- echo "openshift kubeconfig"
- echo "aks kubeconfig"
- ops cloud aks kubeconfig
- KUBECONFIG=conf/osh.kubeconfig oc login https://api.nuvolaris-testing.oshgcp.opstest.top:6443 --insecure-skip-tls-verify=true -u kubeadmin -p $OSH_KUBEADMIN_PASSWORD
- ops cloud osh import conf/osh.kubeconfig
- ops config use