-
Notifications
You must be signed in to change notification settings - Fork 1
490 lines (397 loc) · 20.5 KB
/
night.yaml
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# GitHub runner seems not to support IPv6.
# See https://github.com/actions/runner-images/issues/668
name: Night
on:
workflow_dispatch:
schedule:
- cron: '20 4 * * 2'
push:
branches:
- fix-night-workflow
concurrency: night
jobs:
night:
name: Night
runs-on: ubuntu-22.04
steps:
###################################################
#
# Prepare
#
###################################################
- name: (PREPARE) Checkout Repository
uses: actions/checkout@v3
with:
lfs: true
- name: (PREPARE) Setup Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}"
- name: (PREPARE) Setup GCloud
uses: google-github-actions/setup-gcloud@v1
with:
version: 438.0.0
- name: (PREPARE) Setup GCP credentials
run: |
if [ -z "${GCP_CREDENTIALS}" ]; then
echo "GCP_CREDENTIALS not defined"
exit 1
fi
echo ${GCP_CREDENTIALS} | base64 --decode > /tmp/gcp-credentials.json
env:
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
- name: (PREPARE) Setup OS SSH key file
run: |
if [ -z "${OS_SSH_KEY_FILE}" ]; then
echo "OS_SSH_KEY_FILE not defined"
exit 1
fi
echo ${OS_SSH_KEY_FILE} | base64 --decode > /tmp/os-ssh-key-file
chmod 400 /tmp/os-ssh-key-file
env:
OS_SSH_KEY_FILE: ${{ secrets.OS_SSH_KEY_FILE }}
- name: (PREPARE) Setup OS credentials
run: |
if [ -z "${OS_APPLICATION_CREDENTIAL_ID}" ]; then
echo "OS_APPLICATION_CREDENTIAL_ID not defined"
exit 1
fi
if [ -z "${OS_APPLICATION_CREDENTIAL_SECRET}" ]; then
echo "OS_APPLICATION_CREDENTIAL_SECRET not defined"
exit 1
fi
cat << EOF > /tmp/os-credentials.sh
#!/usr/bin/env bash
export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=https://idm02.bw-cloud.org:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME="Mannheim"
export OS_INTERFACE=public
export OS_APPLICATION_CREDENTIAL_ID=${OS_APPLICATION_CREDENTIAL_ID}
export OS_APPLICATION_CREDENTIAL_SECRET=${OS_APPLICATION_CREDENTIAL_SECRET}
EOF
chmod 755 /tmp/os-credentials.sh
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (PREPARE) Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.10.13
cache: pip
- name: (PREPARE) Cache xOpera
uses: actions/cache@v3
with:
path: /home/runner/opera
key: xopera
- name: (PREPARE) Install xOpera
run: ./src/assets/scripts/install-xopera.sh
- name: (PREPARE) Cache Unfurl
uses: actions/cache@v3
with:
path: /home/runner/unfurl
key: unfurl
- name: (PREPARE) Install Unfurl
run: ./src/assets/scripts/install-unfurl.sh
###################################################
#
# Installation
#
###################################################
- name: (INSTALLATION) Install Vintner
run: curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -
- name: (INSTALLATION) Verify checksum
run: |
wget https://github.com/opentosca/opentosca-vintner/releases/download/latest/vintner-linux-x64.sha256
cp /usr/bin/vintner vintner-linux-x64
sha256sum --check vintner-linux-x64.sha256
rm vintner-linux-x64
rm vintner-linux-x64.sha256
- name: (INSTALLATION) Verify signature
run: |
curl https://vintner.opentosca.org/vintner-release.gpg | gpg --import
wget https://github.com/opentosca/opentosca-vintner/releases/download/latest/vintner-linux-x64.asc
cp /usr/bin/vintner vintner-linux-x64
gpg --verify vintner-linux-x64.asc
rm vintner-linux-x64.asc
###################################################
#
# Unfurl Motivation Production
#
###################################################
- name: (UNFURL-MOTIVATION-PROD) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-MOTIVATION-PROD) Resolve variability
run: |
vintner templates import --template motivation --path examples/unfurl-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets prod
- name: (UNFURL-MOTIVATION-PROD) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-motivation-prod-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
os_application_credential_secret: dummy
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
- name: (UNFURL-MOTIVATION-PROD) Test application
run: curl --fail-with-body https://application-dot-stoetzms-387808.ey.r.appspot.com
- name: (UNFURL-MOTIVATION-PROD) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
- name: Abort
run: exit 1
if: always()
###################################################
#
# Vintner
#
###################################################
- name: (VINTNER) Ensure that version is overridden
run: |
vintner --version
if [ "$(vintner --version)" == "__VERSION__" ]; then
exit 1
fi
- name: (VINTNER) Ensure that license is overridden
run: |
vintner info license
if [ "$(vintner info license)" == "$(cat src/assets/LICENSE)" ]; then
exit 1
fi
- name: (VINTNER) Ensure that dependencies are overridden
run: |
vintner info dependencies
if [ "$(vintner info dependencies)" == "$(cat src/assets/dependencies.csv)" ]; then
exit 1
fi
- name: (VINTNER) Test filesystem initialization
run: vintner setup init
- name: (VINTNER) Test resolver
run: vintner setup benchmark --seeds 10 250
###################################################
#
# Docker
#
###################################################
- name: (DOCKER) Start Docker container
run: |
docker run --detach --name vintner ghcr.io/opentosca/opentosca-vintner:latest
sleep 2
docker logs vintner
- name: (DOCKER) Ensure Vintner can be executed
run: docker exec vintner vintner --version
- name: (DOCKER) Ensure Vintner can be executed
run: |
DOCKER_VERSION=$(docker exec vintner vintner --version)
echo "Docker version: $DOCKER_VERSION}"
BINARY_VERSION=$(vintner --version)
echo "Binary version: ${BINARY_VERSION}"
if [ ${DOCKER_VERSION} != ${BINARY_VERSION} ]; then
echo "Versions do not match"
exit 1
fi
- name: (DOCKER) Stop Docker container
run: docker kill vintner
###################################################
#
# xOpera Motivation Development
#
###################################################
- name: (XOPERA-MOTIVATION-DEV) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-MOTIVATION-DEV) Resolve variability
run: |
vintner templates import --template motivation --path examples/xopera-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets dev
vintner instances validate --instance motivation
- name: (XOPERA-MOTIVATION-DEV) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-motivation-dev-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
os_application_credential_id: ${OS_APPLICATION_CREDENTIAL_ID}
os_application_credential_secret: ${OS_APPLICATION_CREDENTIAL_SECRET}
private_vm_ssh_key_file: /tmp/os-ssh-key-file
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (XOPERA-MOTIVATION-DEV) Test application
run: |
VIRTUAL_MACHINE_NAME=abcdefgh-private-vm
cd ~/opera
. .venv/bin/activate
. /tmp/os-credentials.sh
VIRTUAL_MACHINE_IP=$(openstack server show ${VIRTUAL_MACHINE_NAME} -f json | jq -r '.addresses."public-belwue"[0]')
echo "virtual machine name: ${VIRTUAL_MACHINE_NAME}"
echo "virtual machine ip: ${VIRTUAL_MACHINE_IP}"
curl --fail-with-body http://${VIRTUAL_MACHINE_IP}
- name: (XOPERA-MOTIVATION-DEV) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# xOpera Motivation Production
#
###################################################
- name: (XOPERA-MOTIVATION-PROD) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-MOTIVATION-PROD) Resolve variability
run: |
vintner templates import --template motivation --path examples/xopera-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets prod
vintner instances validate --instance motivation
- name: (XOPERA-MOTIVATION-PROD) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-motivation-prod-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
- name: (XOPERA-MOTIVATION-PROD) Test application
run: curl --fail-with-body https://application-dot-stoetzms-387808.ey.r.appspot.com
- name: (XOPERA-MOTIVATION-PROD) Undeploy application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# xOpera Pruning Elastic
#
###################################################
- name: (XOPERA-PRUNING-ELASTIC) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init xopera
vintner orchestrators enable --orchestrator xopera
vintner orchestrators attest --orchestrator xopera
- name: (XOPERA-PRUNING-ELASTIC) Resolve variability
run: |
vintner templates import --template pruning --path examples/xopera-pruning
vintner instances init --instance pruning --template pruning
vintner instances resolve --instance pruning --presets elastic
vintner instances validate --instance pruning
- name: (XOPERA-PRUNING-ELASTIC) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/xopera-pruning-elastic-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_service_account_file: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance pruning --inputs ${DEPLOYMENT_INPUTS}
- name: (XOPERA-PRUNING-ELASTIC) Test application
run: curl --fail-with-body https://shop-dot-stoetzms-387808.ey.r.appspot.com
- name: (XOPERA-PRUNING-ELASTIC) Undeploy application
run: vintner instances undeploy --instance pruning
if: always()
###################################################
#
# Unfurl Motivation Development
#
###################################################
- name: (UNFURL-MOTIVATION-DEV) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-MOTIVATION-DEV) Resolve variability
run: |
vintner templates import --template motivation --path examples/unfurl-motivation
vintner instances init --instance motivation --template motivation
vintner instances resolve --instance motivation --presets dev
- name: (UNFURL-MOTIVATION-DEV) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-motivation-dev-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
os_application_credential_id: ${OS_APPLICATION_CREDENTIAL_ID}
os_application_credential_secret: ${OS_APPLICATION_CREDENTIAL_SECRET}
vm_ssh_key_file: /tmp/os-ssh-key-file
EOF
vintner instances deploy --instance motivation --inputs ${DEPLOYMENT_INPUTS}
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
- name: (UNFURL-MOTIVATION-DEV) Test the application
run: |
VIRTUAL_MACHINE_NAME=abcdefgh-private-vm
cd ~/unfurl
. .venv/bin/activate
. /tmp/os-credentials.sh
VIRTUAL_MACHINE_IP=$(openstack server show ${VIRTUAL_MACHINE_NAME} -f json | jq -r '.addresses."public-belwue"[0]')
echo "virtual machine name: ${VIRTUAL_MACHINE_NAME}"
echo "virtual machine ip: ${VIRTUAL_MACHINE_IP}"
curl --fail-with-body http://${VIRTUAL_MACHINE_IP}
- name: (UNFURL-MOTIVATION-DEV) Undeploy the application
run: vintner instances undeploy --instance motivation
if: always()
###################################################
#
# Unfurl Artifacts Enterprise
#
###################################################
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Prepare environment
run: |
vintner setup clean --force
vintner setup init
vintner orchestrators init unfurl
vintner orchestrators enable --orchestrator unfurl
vintner orchestrators attest --orchestrator unfurl
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Resolve variability
run: |
vintner templates import --template artifacts --path examples/unfurl-artifacts
vintner instances init --instance artifacts --template artifacts
vintner instances resolve --instance artifacts --inputs examples/unfurl-artifacts/tests/enterprise/inputs.yaml
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Deploy application
run: |
DEPLOYMENT_INPUTS=/tmp/unfurl-artifacts-pruning-elastic-deployment-inputs.yaml
cat << EOF > ${DEPLOYMENT_INPUTS}
gcp_credentials: /tmp/gcp-credentials.json
EOF
vintner instances deploy --instance artifacts --inputs ${DEPLOYMENT_INPUTS}
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Test application
run: curl --fail-with-body https://shop-dot-stoetzms-387808.ey.r.appspot.com
- name: (UNFURL-ARTIFACTS-ENTERPRISE) Undeploy application
run: vintner instances undeploy --instance artifacts
if: always()
###################################################
#
# Notification
#
###################################################
- name: (NOTIFICATION) Send success notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) succeeded.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: success()
- name: (NOTIFICATION) Send failure notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) failed.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: failure()
- name: (DISCORD) Send cancel notification
run: |
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Night workflow [${GITHUB_RUN_ID}](https://github.com/OpenTOSCA/opentosca-vintner/actions/runs/${GITHUB_RUN_ID}) cancelled.\"}" ${DISCORD_WEBHOOK_NIGHT_WORKFLOW}
env:
DISCORD_WEBHOOK_NIGHT_WORKFLOW: ${{ secrets.DISCORD_WEBHOOK_NIGHT_WORKFLOW }}
if: cancelled()