-
Notifications
You must be signed in to change notification settings - Fork 0
3158 lines (2842 loc) · 135 KB
/
e2e-daily.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
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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# THIS FILE IS GENERATED, PLEASE DO NOT EDIT.
#
# Copyright 2022 Flant JSC
#
# Licensed 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.
name: 'Daily e2e tests'
on:
schedule:
- cron: '0 1 * * 1-5'
workflow_dispatch:
env:
WERF_DRY_RUN: "false"
# <template: werf_envs>
WERF_CHANNEL: "ea"
WERF_ENV: "FE"
TEST_TIMEOUT: "15m"
# Use fixed string 'sys/deckhouse-oss' for repo name. ${CI_PROJECT_PATH} is not available here in GitHub.
DEV_REGISTRY_PATH: "${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/sys/deckhouse-oss"
# Registry for additional repositories used for testing Github Actions workflows.
GHA_TEST_REGISTRY_PATH: "ghcr.io/${{ github.repository }}"
# </template: werf_envs>
# Always run a single job at a time.
# Note: Concurrency is currently in beta and subject to change.
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
concurrency:
group: e2e-daily
jobs:
skip_tests_repos:
name: Skip tests repos
runs-on: ubuntu-latest
if: ${{ false || github.repository == 'deckhouse/deckhouse' }}
steps:
- name: Do nothing
run: echo "Empty action to fulfil Github requirements."
# Note: git_info is needed for werf.yaml
# <template: git_info_job>
git_info:
name: Get git info
runs-on: ubuntu-latest
needs:
- skip_tests_repos
outputs:
ci_commit_tag: ${{ steps.git_info.outputs.ci_commit_tag }}
ci_commit_branch: ${{ steps.git_info.outputs.ci_commit_branch }}
ci_commit_ref_name: ${{ steps.git_info.outputs.ci_commit_ref_name }}
ci_commit_ref_slug: ${{ steps.git_info.outputs.ci_commit_ref_slug }}
ref_full: ${{ steps.git_info.outputs.ref_full }}
github_sha: ${{ steps.git_info.outputs.github_sha }}
pr_number: ${{ steps.git_info.outputs.pr_number }}
# Skip the CI for automation PRs, e.g. changelog
if: ${{ github.event.pull_request.user.login != 'deckhouse-BOaTswain' }}
steps:
- id: git_info
name: Get tag name and SHA
uses: actions/[email protected]
with:
script: |
const { GITHUB_REF_TYPE, GITHUB_REF_NAME, GITHUB_REF } = process.env
let refSlug = ''
let refName = ''
let refFull = ''
let githubBranch = ''
let githubTag = ''
let githubSHA = ''
let prNumber = ''
if (context.eventName === "workflow_dispatch" && context.payload.inputs && context.payload.inputs.pull_request_ref) {
// Trigger: workflow_dispatch with pull_request_ref.
// Extract pull request number from 'refs/pull/<NUM>/merge'
prNumber = context.payload.inputs.pull_request_ref.replace('refs/pull/', '').replace('/merge', '').replace('/head', '')
refSlug = `pr${prNumber}`
refName = context.payload.inputs.ci_commit_ref_name
refFull = context.payload.inputs.pull_request_ref
githubBranch = refName
githubSHA = context.payload.inputs.pull_request_sha
core.info(`workflow_dispatch event: set git info from inputs. inputs: ${JSON.stringify(context.payload.inputs)}`)
} else if (context.eventName === "pull_request" || context.eventName === "pull_request_target" ) {
// For PRs from forks, tag images with `prXXX` to avoid clashes between branches.
const targetRepo = context.payload.repository.full_name;
const prRepo = context.payload.pull_request.head.repo.full_name
const prRef = context.payload.pull_request.head.ref
refSlug = `pr${context.issue.number}`;
refName = (prRepo === targetRepo) ? prRef : refSlug;
refFull = `refs/pull/${context.issue.number}/head`
githubBranch = refName
githubSHA = context.payload.pull_request.head.sha
core.info(`pull request event: set git info from pull_request.head. pr:${prRepo}:${prRef} target:${targetRepo}:${context.ref}`)
prNumber = context.issue.number
} else {
// Other triggers: workflow_dispatch without pull_request_ref, schedule, push...
// refName is 'main' or tag name, so slugification is not necessary.
refSlug = GITHUB_REF_NAME
refName = GITHUB_REF_NAME
refFull = GITHUB_REF
githubTag = GITHUB_REF_TYPE == "tag" ? refName : ""
githubBranch = GITHUB_REF_TYPE == "branch" ? refName : ""
githubSHA = context.sha
core.info(`${context.eventName} event: set git info from context: ${JSON.stringify({GITHUB_REF_NAME, GITHUB_REF_TYPE, sha: context.sha })}`)
}
core.setCommandEcho(true)
core.setOutput('ci_commit_ref_slug', refSlug)
core.setOutput('ci_commit_ref_name', refName)
core.setOutput(`ci_commit_tag`, githubTag)
core.setOutput(`ci_commit_branch`, githubBranch)
core.setOutput(`ref_full`, refFull)
core.setOutput('github_sha', githubSHA)
core.setOutput('pr_number', prNumber)
core.setCommandEcho(false)
# </template: git_info_job>
# <template: e2e_run_job_template>
run_aws_containerd_1_25:
name: "AWS, Containerd, Kubernetes 1.25"
needs:
- git_info
outputs:
ssh_master_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_master_connection_string }}
ssh_bastion_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_bastion_connection_string }}
run_id: ${{ github.run_id }}
# need for find state in artifact
cluster_prefix: ${{ steps.setup.outputs.dhctl-prefix }}
ran_for: "aws;WithoutNAT;containerd;1.25"
failed_cluster_stayed: ${{ steps.check_stay_failed_cluster.outputs.failed_cluster_stayed }}
issue_number: ${{ inputs.issue_number }}
install_image_path: ${{ steps.setup.outputs.install-image-path }}
env:
PROVIDER: AWS
CRI: Containerd
LAYOUT: WithoutNAT
KUBERNETES_VERSION: "1.25"
EVENT_LABEL: ${{ github.event.label.name }}
runs-on: [self-hosted, e2e-common]
steps:
# <template: started_at_output>
- name: Job started timestamp
id: started_at
run: |
unixTimestamp=$(date +%s)
echo "started_at=${unixTimestamp}" >> $GITHUB_OUTPUT
# </template: started_at_output>
# <template: checkout_from_event_ref_step>
- name: Checkout sources
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.pull_request_ref || github.event.ref }}
fetch-depth: 0
# </template: checkout_from_event_ref_step>
# <template: login_dev_registry_step>
- name: Check dev registry credentials
id: check_dev_registry
env:
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to dev registry
uses: docker/[email protected]
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }}
logout: false
# </template: login_dev_registry_step>
# <template: login_rw_registry_step>
- name: Check rw registry credentials
id: check_rw_registry
env:
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to rw registry
uses: docker/[email protected]
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
logout: false
- name: Login to Github Container Registry
uses: docker/[email protected]
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_IO_REGISTRY_USER }}
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }}
logout: false
# </template: login_rw_registry_step>
# <template: werf_install_step>
- name: Install werf CLI
uses: werf/actions/[email protected]
with:
channel: ${{env.WERF_CHANNEL}}
# </template: werf_install_step>
- name: Setup
id: setup
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
CI_COMMIT_BRANCH: ${{needs.git_info.outputs.ci_commit_branch}}
CI_COMMIT_REF_SLUG: ${{needs.git_info.outputs.ci_commit_ref_slug}}
REF_FULL: ${{needs.git_info.outputs.ref_full}}
INITIAL_REF_SLUG: ${{ github.event.inputs.initial_ref_slug }}
MANUAL_RUN: "false"
run: |
# Calculate unique prefix for e2e test.
# GITHUB_RUN_ID is a unique number for each workflow run.
# GITHUB_RUN_ATTEMPT is a unique number for each attempt of a particular workflow run in a repository.
# Add CRI and KUBERNETES_VERSION to create unique directory for each job.
# CRI and PROVIDER values are trimmed to reduce prefix length.
DHCTL_PREFIX=$(echo "${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-$(echo ${CRI} | head -c 3)-${KUBERNETES_VERSION}")
if [[ "${MANUAL_RUN}" == "false" ]] ; then
# for jobs which run multiple providers concurrency (daily e2e, for example)
# add provider suffix to prevent "directory already exists" error
DHCTL_PREFIX="${DHCTL_PREFIX}-$(echo ${PROVIDER} | head -c 2)"
fi
# converts to DNS-like (all letters in lower case and replace all dots to dash)
# because it prefix will use for k8s resources names (nodes, for example)
DHCTL_PREFIX=$(echo "$DHCTL_PREFIX" | tr '.' '-' | tr '[:upper:]' '[:lower:]')
# Create tmppath for test script.
TMP_DIR_PATH=/mnt/cloud-layouts/layouts/${DHCTL_PREFIX}
if [[ -d "${TMP_DIR_PATH}" ]] ; then
echo "Temporary dir already exists: ${TMP_DIR_PATH}. ERROR!"
ls -la ${TMP_DIR_PATH}
exit 1
else
echo "Create temporary dir for job: ${TMP_DIR_PATH}."
mkdir -p "${TMP_DIR_PATH}"
fi
## Source: ci_templates/build.yml
# Extract REPO_SUFFIX from repository name: trim prefix 'deckhouse/deckhouse-'.
REPO_SUFFIX=${GITHUB_REPOSITORY#deckhouse/deckhouse-}
if [[ $REPO_SUFFIX == $GITHUB_REPOSITORY ]] ; then
# REPO_SUFFIX should be empty for main repo 'deckhouse/deckhouse'.
REPO_SUFFIX=
fi
# Use dev-registry for Git branches.
BRANCH_REGISTRY_PATH="${DEV_REGISTRY_PATH}"
# Use rw-registry for Git tags.
SEMVER_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z ${DECKHOUSE_REGISTRY_HOST:-} ]] ; then
# DECKHOUSE_REGISTRY_HOST is empty, so this repo is not the main repo.
# Use dev-regisry for branches and Github Container Registry for semver tags.
BRANCH_REGISTRY_PATH="${DEV_REGISTRY_PATH}"
SEMVER_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
fi
# Prepare initial image tag for deploy/deckhouse to test switching from previous release.
INITIAL_IMAGE_TAG=
if [[ -n ${INITIAL_REF_SLUG} ]] ; then
INITIAL_IMAGE_TAG=${INITIAL_REF_SLUG}${REPO_SUFFIX:+-${REPO_SUFFIX}}
fi
# Prepare image tag for deploy/deckhouse (DECKHOUSE_IMAGE_TAG option in testing/cloud_layouts/script.sh).
# CI_COMMIT_REF_SLUG is a 'prNUM' for dev branches or 'main' for default branch.
# Use it as image tag. Add suffix to not overlap with PRs in main repo.
IMAGE_TAG=${CI_COMMIT_REF_SLUG}${REPO_SUFFIX:+-${REPO_SUFFIX}}
INSTALL_IMAGE_NAME=
if [[ -n ${CI_COMMIT_BRANCH} ]]; then
# CI_COMMIT_REF_SLUG is a 'prNUM' for dev branches or 'main' for default branch.
INSTALL_IMAGE_NAME=${BRANCH_REGISTRY_PATH}/install:${IMAGE_TAG}
fi
if [[ -n ${CI_COMMIT_TAG} ]] ; then
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]') # CE/EE/FE -> ce/ee/fe
INSTALL_IMAGE_NAME=${SEMVER_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_REF_SLUG}
fi
if [[ -n ${INITIAL_REF_SLUG} ]] ; then
INSTALL_IMAGE_NAME=${BRANCH_REGISTRY_PATH}/install:${INITIAL_IMAGE_TAG}
git fetch origin ${INITIAL_REF_SLUG}
git checkout origin/${INITIAL_REF_SLUG} -- testing/cloud_layouts
fi
SAFE_IMAGE_NAME=$(echo ${INSTALL_IMAGE_NAME} | tr '[:lower:]' '[:upper:]')
echo "Deckhouse Deployment will use install image ${SAFE_IMAGE_NAME} to test Git ref ${REF_FULL}"
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
echo "⚓️ [$(date -u)] Pull 'dev/install' image '${SAFE_IMAGE_NAME}'."
docker pull "${INSTALL_IMAGE_NAME}"
IMAGE_INSTALL_PATH="/${INSTALL_IMAGE_NAME#*/}"
echo '::echo::on'
echo "tmp-dir-path=${TMP_DIR_PATH}" >> $GITHUB_OUTPUT
echo "dhctl-log-file=${TMP_DIR_PATH}/dhctl.log" >> $GITHUB_OUTPUT
echo "dhctl-prefix=${DHCTL_PREFIX}" >> $GITHUB_OUTPUT
echo "install-image-name=${INSTALL_IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "deckhouse-image-tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "initial-image-tag=${INITIAL_IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "install-image-path=${IMAGE_INSTALL_PATH}" >> $GITHUB_OUTPUT
echo '::echo::off'
- name: "Run e2e test: AWS/Containerd/1.25"
id: e2e_test_run
timeout-minutes: 80
env:
PROVIDER: AWS
CRI: Containerd
LAYOUT: WithoutNAT
KUBERNETES_VERSION: "1.25"
LAYOUT_DECKHOUSE_DOCKERCFG: ${{ secrets.LAYOUT_DECKHOUSE_DOCKERCFG }}
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY}}
TMP_DIR_PATH: ${{ steps.setup.outputs.tmp-dir-path}}
PREFIX: ${{ steps.setup.outputs.dhctl-prefix}}
INSTALL_IMAGE_NAME: ${{ steps.setup.outputs.install-image-name }}
DECKHOUSE_IMAGE_TAG: ${{ steps.setup.outputs.deckhouse-image-tag }}
INITIAL_IMAGE_TAG: ${{ steps.setup.outputs.initial-image-tag }}
# <template: e2e_run_template>
LAYOUT_AWS_ACCESS_KEY: ${{ secrets.LAYOUT_AWS_ACCESS_KEY }}
LAYOUT_AWS_SECRET_ACCESS_KEY: ${{ secrets.LAYOUT_AWS_SECRET_ACCESS_KEY }}
COMMENT_ID: ${{ inputs.comment_id }}
GITHUB_API_SERVER: ${{ github.api_url }}
REPOSITORY: ${{ github.repository }}
DHCTL_LOG_FILE: ${{ steps.setup.outputs.dhctl-log-file}}
GITHUB_TOKEN: ${{secrets.BOATSWAIN_GITHUB_TOKEN}}
run: |
echo "Execute 'script.sh run-test' via 'docker run', using environment:
INSTALL_IMAGE_NAME=${INSTALL_IMAGE_NAME}
DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG}
INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG}
PREFIX=${PREFIX}
PROVIDER=${PROVIDER}
CRI=${CRI}
LAYOUT=${LAYOUT}
KUBERNETES_VERSION=${KUBERNETES_VERSION}
TMP_DIR_PATH=${TMP_DIR_PATH}
"
ls -lh $(pwd)/testing
dhctl_log_file="${DHCTL_LOG_FILE}-${PROVIDER}-${LAYOUT}-${CRI}-${KUBERNETES_VERSION}"
echo "DHCTL log file: $dhctl_log_file"
docker run --rm \
-e DECKHOUSE_DOCKERCFG=${LAYOUT_DECKHOUSE_DOCKERCFG} \
-e PREFIX=${PREFIX} \
-e DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG} \
-e INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG} \
-e KUBERNETES_VERSION=${KUBERNETES_VERSION} \
-e CRI=${CRI} \
-e PROVIDER=${PROVIDER:-not_provided} \
-e MASTER_CONNECTION_STRING=${SSH_MASTER_CONNECTION_STRING:-} \
-e LAYOUT=${LAYOUT:-not_provided} \
-e DHCTL_LOG_FILE="/tmp/$(basename ${dhctl_log_file})" \
-e SSH_KEY=${LAYOUT_SSH_KEY:-not_provided} \
-e LAYOUT_AWS_ACCESS_KEY=${LAYOUT_AWS_ACCESS_KEY:-not_provided} \
-e LAYOUT_AWS_SECRET_ACCESS_KEY=${LAYOUT_AWS_SECRET_ACCESS_KEY:-not_provided} \
-v $(pwd)/testing:/deckhouse/testing \
-v ${TMP_DIR_PATH}:/tmp \
--user $(id -u):$(id -u) \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/shadow:/etc/shadow:ro \
-w /deckhouse \
${INSTALL_IMAGE_NAME} \
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>
- name: Cleanup bootstrapped cluster
if: always()
id: cleanup_cluster
timeout-minutes: 60
env:
PROVIDER: AWS
CRI: Containerd
LAYOUT: WithoutNAT
KUBERNETES_VERSION: "1.25"
LAYOUT_DECKHOUSE_DOCKERCFG: ${{ secrets.LAYOUT_DECKHOUSE_DOCKERCFG }}
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY}}
TMP_DIR_PATH: ${{ steps.setup.outputs.tmp-dir-path}}
PREFIX: ${{ steps.setup.outputs.dhctl-prefix}}
INSTALL_IMAGE_NAME: ${{ steps.setup.outputs.install-image-name }}
DECKHOUSE_IMAGE_TAG: ${{ steps.setup.outputs.deckhouse-image-tag }}
# <template: e2e_run_template>
LAYOUT_AWS_ACCESS_KEY: ${{ secrets.LAYOUT_AWS_ACCESS_KEY }}
LAYOUT_AWS_SECRET_ACCESS_KEY: ${{ secrets.LAYOUT_AWS_SECRET_ACCESS_KEY }}
COMMENT_ID: ${{ inputs.comment_id }}
GITHUB_API_SERVER: ${{ github.api_url }}
REPOSITORY: ${{ github.repository }}
DHCTL_LOG_FILE: ${{ steps.setup.outputs.dhctl-log-file}}
GITHUB_TOKEN: ${{secrets.BOATSWAIN_GITHUB_TOKEN}}
run: |
echo "Execute 'script.sh cleanup' via 'docker run', using environment:
INSTALL_IMAGE_NAME=${INSTALL_IMAGE_NAME}
DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG}
INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG}
PREFIX=${PREFIX}
PROVIDER=${PROVIDER}
CRI=${CRI}
LAYOUT=${LAYOUT}
KUBERNETES_VERSION=${KUBERNETES_VERSION}
TMP_DIR_PATH=${TMP_DIR_PATH}
"
ls -lh $(pwd)/testing
dhctl_log_file="${DHCTL_LOG_FILE}-${PROVIDER}-${LAYOUT}-${CRI}-${KUBERNETES_VERSION}"
echo "DHCTL log file: $dhctl_log_file"
docker run --rm \
-e DECKHOUSE_DOCKERCFG=${LAYOUT_DECKHOUSE_DOCKERCFG} \
-e PREFIX=${PREFIX} \
-e DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG} \
-e INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG} \
-e KUBERNETES_VERSION=${KUBERNETES_VERSION} \
-e CRI=${CRI} \
-e PROVIDER=${PROVIDER:-not_provided} \
-e MASTER_CONNECTION_STRING=${SSH_MASTER_CONNECTION_STRING:-} \
-e LAYOUT=${LAYOUT:-not_provided} \
-e DHCTL_LOG_FILE="/tmp/$(basename ${dhctl_log_file})" \
-e SSH_KEY=${LAYOUT_SSH_KEY:-not_provided} \
-e LAYOUT_AWS_ACCESS_KEY=${LAYOUT_AWS_ACCESS_KEY:-not_provided} \
-e LAYOUT_AWS_SECRET_ACCESS_KEY=${LAYOUT_AWS_SECRET_ACCESS_KEY:-not_provided} \
-v $(pwd)/testing:/deckhouse/testing \
-v ${TMP_DIR_PATH}:/tmp \
--user $(id -u):$(id -u) \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/shadow:/etc/shadow:ro \
-w /deckhouse \
${INSTALL_IMAGE_NAME} \
bash /deckhouse/testing/cloud_layouts/script.sh cleanup
# </template: e2e_run_template>
- name: Save dhctl state
id: save_failed_cluster_state
if: ${{ failure() }}
uses: actions/[email protected]
with:
name: failed_cluster_state_aws_containerd_1_25
path: |
${{ steps.setup.outputs.tmp-dir-path}}/dhctl
${{ steps.setup.outputs.tmp-dir-path}}/*.tfstate
${{ steps.setup.outputs.tmp-dir-path}}/logs
- name: Save test results
if: ${{ steps.setup.outputs.dhctl-log-file }}
uses: actions/[email protected]
with:
name: test_output_aws_containerd_1_25
path: |
${{ steps.setup.outputs.dhctl-log-file}}*
${{ steps.setup.outputs.tmp-dir-path}}/logs
testing/cloud_layouts/
!testing/cloud_layouts/**/sshkey
- name: Cleanup temp directory
if: always()
env:
TMPPATH: ${{ steps.setup.outputs.tmppath}}
run: |
echo "Remove temporary directory '${TMPPATH}' ..."
if [[ -d "${TMPPATH}" && ${#TMPPATH} > 1 ]] ; then
rm -rf "${TMPPATH}"
else
echo Not a directory.
fi
# <template: send_alert_template>
- name: Check alerting credentials
id: check_alerting
if: always()
env:
KEY: ${{secrets.CLOUD_LAYOUT_TESTS_MADISON_KEY}}
run: |
if [[ -n $KEY ]]; then echo "has_credentials=true" >> $GITHUB_OUTPUT; fi
- name: Send alert on fail
if: ${{ steps.check_alerting.outputs.has_credentials == 'true' && (github.ref == 'refs/heads/main' && (cancelled() || failure())) }}
env:
CLOUD_LAYOUT_TESTS_MADISON_KEY: ${{secrets.CLOUD_LAYOUT_TESTS_MADISON_KEY}}
run: |
WORKFLOW_URL="${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
echo $WORKFLOW_URL
alertData=$(cat <<EOF
{
"labels": {
"cri": "Containerd",
"kube_version": "1.25",
"layout": "WithoutNAT",
"provider": "AWS",
"trigger": "CloudLayoutTestFailed",
"severity_level": 7
},
"annotations": {
"description": "Check Github workflow log for more information",
"plk_create_group_if_not_exists/cloudlayouttestfailed": "CloudLayoutTestFailedGroup",
"plk_grouped_by/cloudlayouttestfailed": "CloudLayoutTestFailedGroup",
"summary": "Cloud Layout Test failed",
"plk_link_url/job": "${WORKFLOW_URL}",
"plk_protocol_version": "1",
"plk_link_title_en/job": "Github job run"
}
}
EOF
)
for (( iter = 1; iter < 60; iter++ )); do
if curl -sS -X "POST" "https://madison.flant.com/api/events/custom/${CLOUD_LAYOUT_TESTS_MADISON_KEY}" -H 'Content-Type: application/json' -d "${alertData}"; then
exit 0
fi
echo "Alert was not sent. Wait 5 seconds before next attempt"
sleep 5
done
echo "Alert was not sent. Timeout"
exit 1
# </template: send_alert_template>
# </template: e2e_run_job_template>
# <template: e2e_run_job_template>
run_azure_containerd_1_25:
name: "Azure, Containerd, Kubernetes 1.25"
needs:
- git_info
outputs:
ssh_master_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_master_connection_string }}
ssh_bastion_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_bastion_connection_string }}
run_id: ${{ github.run_id }}
# need for find state in artifact
cluster_prefix: ${{ steps.setup.outputs.dhctl-prefix }}
ran_for: "azure;Standard;containerd;1.25"
failed_cluster_stayed: ${{ steps.check_stay_failed_cluster.outputs.failed_cluster_stayed }}
issue_number: ${{ inputs.issue_number }}
install_image_path: ${{ steps.setup.outputs.install-image-path }}
env:
PROVIDER: Azure
CRI: Containerd
LAYOUT: Standard
KUBERNETES_VERSION: "1.25"
EVENT_LABEL: ${{ github.event.label.name }}
runs-on: [self-hosted, e2e-common]
steps:
# <template: started_at_output>
- name: Job started timestamp
id: started_at
run: |
unixTimestamp=$(date +%s)
echo "started_at=${unixTimestamp}" >> $GITHUB_OUTPUT
# </template: started_at_output>
# <template: checkout_from_event_ref_step>
- name: Checkout sources
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.pull_request_ref || github.event.ref }}
fetch-depth: 0
# </template: checkout_from_event_ref_step>
# <template: login_dev_registry_step>
- name: Check dev registry credentials
id: check_dev_registry
env:
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to dev registry
uses: docker/[email protected]
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }}
logout: false
# </template: login_dev_registry_step>
# <template: login_rw_registry_step>
- name: Check rw registry credentials
id: check_rw_registry
env:
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to rw registry
uses: docker/[email protected]
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
logout: false
- name: Login to Github Container Registry
uses: docker/[email protected]
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_IO_REGISTRY_USER }}
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }}
logout: false
# </template: login_rw_registry_step>
# <template: werf_install_step>
- name: Install werf CLI
uses: werf/actions/[email protected]
with:
channel: ${{env.WERF_CHANNEL}}
# </template: werf_install_step>
- name: Setup
id: setup
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
CI_COMMIT_BRANCH: ${{needs.git_info.outputs.ci_commit_branch}}
CI_COMMIT_REF_SLUG: ${{needs.git_info.outputs.ci_commit_ref_slug}}
REF_FULL: ${{needs.git_info.outputs.ref_full}}
INITIAL_REF_SLUG: ${{ github.event.inputs.initial_ref_slug }}
MANUAL_RUN: "false"
run: |
# Calculate unique prefix for e2e test.
# GITHUB_RUN_ID is a unique number for each workflow run.
# GITHUB_RUN_ATTEMPT is a unique number for each attempt of a particular workflow run in a repository.
# Add CRI and KUBERNETES_VERSION to create unique directory for each job.
# CRI and PROVIDER values are trimmed to reduce prefix length.
DHCTL_PREFIX=$(echo "${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-$(echo ${CRI} | head -c 3)-${KUBERNETES_VERSION}")
if [[ "${MANUAL_RUN}" == "false" ]] ; then
# for jobs which run multiple providers concurrency (daily e2e, for example)
# add provider suffix to prevent "directory already exists" error
DHCTL_PREFIX="${DHCTL_PREFIX}-$(echo ${PROVIDER} | head -c 2)"
fi
# converts to DNS-like (all letters in lower case and replace all dots to dash)
# because it prefix will use for k8s resources names (nodes, for example)
DHCTL_PREFIX=$(echo "$DHCTL_PREFIX" | tr '.' '-' | tr '[:upper:]' '[:lower:]')
# Create tmppath for test script.
TMP_DIR_PATH=/mnt/cloud-layouts/layouts/${DHCTL_PREFIX}
if [[ -d "${TMP_DIR_PATH}" ]] ; then
echo "Temporary dir already exists: ${TMP_DIR_PATH}. ERROR!"
ls -la ${TMP_DIR_PATH}
exit 1
else
echo "Create temporary dir for job: ${TMP_DIR_PATH}."
mkdir -p "${TMP_DIR_PATH}"
fi
## Source: ci_templates/build.yml
# Extract REPO_SUFFIX from repository name: trim prefix 'deckhouse/deckhouse-'.
REPO_SUFFIX=${GITHUB_REPOSITORY#deckhouse/deckhouse-}
if [[ $REPO_SUFFIX == $GITHUB_REPOSITORY ]] ; then
# REPO_SUFFIX should be empty for main repo 'deckhouse/deckhouse'.
REPO_SUFFIX=
fi
# Use dev-registry for Git branches.
BRANCH_REGISTRY_PATH="${DEV_REGISTRY_PATH}"
# Use rw-registry for Git tags.
SEMVER_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z ${DECKHOUSE_REGISTRY_HOST:-} ]] ; then
# DECKHOUSE_REGISTRY_HOST is empty, so this repo is not the main repo.
# Use dev-regisry for branches and Github Container Registry for semver tags.
BRANCH_REGISTRY_PATH="${DEV_REGISTRY_PATH}"
SEMVER_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
fi
# Prepare initial image tag for deploy/deckhouse to test switching from previous release.
INITIAL_IMAGE_TAG=
if [[ -n ${INITIAL_REF_SLUG} ]] ; then
INITIAL_IMAGE_TAG=${INITIAL_REF_SLUG}${REPO_SUFFIX:+-${REPO_SUFFIX}}
fi
# Prepare image tag for deploy/deckhouse (DECKHOUSE_IMAGE_TAG option in testing/cloud_layouts/script.sh).
# CI_COMMIT_REF_SLUG is a 'prNUM' for dev branches or 'main' for default branch.
# Use it as image tag. Add suffix to not overlap with PRs in main repo.
IMAGE_TAG=${CI_COMMIT_REF_SLUG}${REPO_SUFFIX:+-${REPO_SUFFIX}}
INSTALL_IMAGE_NAME=
if [[ -n ${CI_COMMIT_BRANCH} ]]; then
# CI_COMMIT_REF_SLUG is a 'prNUM' for dev branches or 'main' for default branch.
INSTALL_IMAGE_NAME=${BRANCH_REGISTRY_PATH}/install:${IMAGE_TAG}
fi
if [[ -n ${CI_COMMIT_TAG} ]] ; then
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]') # CE/EE/FE -> ce/ee/fe
INSTALL_IMAGE_NAME=${SEMVER_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_REF_SLUG}
fi
if [[ -n ${INITIAL_REF_SLUG} ]] ; then
INSTALL_IMAGE_NAME=${BRANCH_REGISTRY_PATH}/install:${INITIAL_IMAGE_TAG}
git fetch origin ${INITIAL_REF_SLUG}
git checkout origin/${INITIAL_REF_SLUG} -- testing/cloud_layouts
fi
SAFE_IMAGE_NAME=$(echo ${INSTALL_IMAGE_NAME} | tr '[:lower:]' '[:upper:]')
echo "Deckhouse Deployment will use install image ${SAFE_IMAGE_NAME} to test Git ref ${REF_FULL}"
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
echo "⚓️ [$(date -u)] Pull 'dev/install' image '${SAFE_IMAGE_NAME}'."
docker pull "${INSTALL_IMAGE_NAME}"
IMAGE_INSTALL_PATH="/${INSTALL_IMAGE_NAME#*/}"
echo '::echo::on'
echo "tmp-dir-path=${TMP_DIR_PATH}" >> $GITHUB_OUTPUT
echo "dhctl-log-file=${TMP_DIR_PATH}/dhctl.log" >> $GITHUB_OUTPUT
echo "dhctl-prefix=${DHCTL_PREFIX}" >> $GITHUB_OUTPUT
echo "install-image-name=${INSTALL_IMAGE_NAME}" >> $GITHUB_OUTPUT
echo "deckhouse-image-tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "initial-image-tag=${INITIAL_IMAGE_TAG}" >> $GITHUB_OUTPUT
echo "install-image-path=${IMAGE_INSTALL_PATH}" >> $GITHUB_OUTPUT
echo '::echo::off'
- name: "Run e2e test: Azure/Containerd/1.25"
id: e2e_test_run
timeout-minutes: 80
env:
PROVIDER: Azure
CRI: Containerd
LAYOUT: Standard
KUBERNETES_VERSION: "1.25"
LAYOUT_DECKHOUSE_DOCKERCFG: ${{ secrets.LAYOUT_DECKHOUSE_DOCKERCFG }}
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY}}
TMP_DIR_PATH: ${{ steps.setup.outputs.tmp-dir-path}}
PREFIX: ${{ steps.setup.outputs.dhctl-prefix}}
INSTALL_IMAGE_NAME: ${{ steps.setup.outputs.install-image-name }}
DECKHOUSE_IMAGE_TAG: ${{ steps.setup.outputs.deckhouse-image-tag }}
INITIAL_IMAGE_TAG: ${{ steps.setup.outputs.initial-image-tag }}
# <template: e2e_run_template>
LAYOUT_AZURE_SUBSCRIPTION_ID: ${{ secrets.LAYOUT_AZURE_SUBSCRIPTION_ID }}
LAYOUT_AZURE_CLIENT_ID: ${{ secrets.LAYOUT_AZURE_CLIENT_ID }}
LAYOUT_AZURE_CLIENT_SECRET: ${{ secrets.LAYOUT_AZURE_CLIENT_SECRET }}
LAYOUT_AZURE_TENANT_ID: ${{ secrets.LAYOUT_AZURE_TENANT_ID }}
COMMENT_ID: ${{ inputs.comment_id }}
GITHUB_API_SERVER: ${{ github.api_url }}
REPOSITORY: ${{ github.repository }}
DHCTL_LOG_FILE: ${{ steps.setup.outputs.dhctl-log-file}}
GITHUB_TOKEN: ${{secrets.BOATSWAIN_GITHUB_TOKEN}}
run: |
echo "Execute 'script.sh run-test' via 'docker run', using environment:
INSTALL_IMAGE_NAME=${INSTALL_IMAGE_NAME}
DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG}
INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG}
PREFIX=${PREFIX}
PROVIDER=${PROVIDER}
CRI=${CRI}
LAYOUT=${LAYOUT}
KUBERNETES_VERSION=${KUBERNETES_VERSION}
TMP_DIR_PATH=${TMP_DIR_PATH}
"
ls -lh $(pwd)/testing
dhctl_log_file="${DHCTL_LOG_FILE}-${PROVIDER}-${LAYOUT}-${CRI}-${KUBERNETES_VERSION}"
echo "DHCTL log file: $dhctl_log_file"
docker run --rm \
-e DECKHOUSE_DOCKERCFG=${LAYOUT_DECKHOUSE_DOCKERCFG} \
-e PREFIX=${PREFIX} \
-e DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG} \
-e INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG} \
-e KUBERNETES_VERSION=${KUBERNETES_VERSION} \
-e CRI=${CRI} \
-e PROVIDER=${PROVIDER:-not_provided} \
-e MASTER_CONNECTION_STRING=${SSH_MASTER_CONNECTION_STRING:-} \
-e LAYOUT=${LAYOUT:-not_provided} \
-e DHCTL_LOG_FILE="/tmp/$(basename ${dhctl_log_file})" \
-e SSH_KEY=${LAYOUT_SSH_KEY:-not_provided} \
-e LAYOUT_AZURE_SUBSCRIPTION_ID=${LAYOUT_AZURE_SUBSCRIPTION_ID:-not_provided} \
-e LAYOUT_AZURE_CLIENT_ID=${LAYOUT_AZURE_CLIENT_ID:-not_provided} \
-e LAYOUT_AZURE_CLIENT_SECRET=${LAYOUT_AZURE_CLIENT_SECRET:-not_provided} \
-e LAYOUT_AZURE_TENANT_ID=${LAYOUT_AZURE_TENANT_ID:-not_provided} \
-v $(pwd)/testing:/deckhouse/testing \
-v ${TMP_DIR_PATH}:/tmp \
--user $(id -u):$(id -u) \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/shadow:/etc/shadow:ro \
-w /deckhouse \
${INSTALL_IMAGE_NAME} \
bash /deckhouse/testing/cloud_layouts/script.sh run-test
# </template: e2e_run_template>
- name: Cleanup bootstrapped cluster
if: always()
id: cleanup_cluster
timeout-minutes: 60
env:
PROVIDER: Azure
CRI: Containerd
LAYOUT: Standard
KUBERNETES_VERSION: "1.25"
LAYOUT_DECKHOUSE_DOCKERCFG: ${{ secrets.LAYOUT_DECKHOUSE_DOCKERCFG }}
LAYOUT_SSH_KEY: ${{ secrets.LAYOUT_SSH_KEY}}
TMP_DIR_PATH: ${{ steps.setup.outputs.tmp-dir-path}}
PREFIX: ${{ steps.setup.outputs.dhctl-prefix}}
INSTALL_IMAGE_NAME: ${{ steps.setup.outputs.install-image-name }}
DECKHOUSE_IMAGE_TAG: ${{ steps.setup.outputs.deckhouse-image-tag }}
# <template: e2e_run_template>
LAYOUT_AZURE_SUBSCRIPTION_ID: ${{ secrets.LAYOUT_AZURE_SUBSCRIPTION_ID }}
LAYOUT_AZURE_CLIENT_ID: ${{ secrets.LAYOUT_AZURE_CLIENT_ID }}
LAYOUT_AZURE_CLIENT_SECRET: ${{ secrets.LAYOUT_AZURE_CLIENT_SECRET }}
LAYOUT_AZURE_TENANT_ID: ${{ secrets.LAYOUT_AZURE_TENANT_ID }}
COMMENT_ID: ${{ inputs.comment_id }}
GITHUB_API_SERVER: ${{ github.api_url }}
REPOSITORY: ${{ github.repository }}
DHCTL_LOG_FILE: ${{ steps.setup.outputs.dhctl-log-file}}
GITHUB_TOKEN: ${{secrets.BOATSWAIN_GITHUB_TOKEN}}
run: |
echo "Execute 'script.sh cleanup' via 'docker run', using environment:
INSTALL_IMAGE_NAME=${INSTALL_IMAGE_NAME}
DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG}
INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG}
PREFIX=${PREFIX}
PROVIDER=${PROVIDER}
CRI=${CRI}
LAYOUT=${LAYOUT}
KUBERNETES_VERSION=${KUBERNETES_VERSION}
TMP_DIR_PATH=${TMP_DIR_PATH}
"
ls -lh $(pwd)/testing
dhctl_log_file="${DHCTL_LOG_FILE}-${PROVIDER}-${LAYOUT}-${CRI}-${KUBERNETES_VERSION}"
echo "DHCTL log file: $dhctl_log_file"
docker run --rm \
-e DECKHOUSE_DOCKERCFG=${LAYOUT_DECKHOUSE_DOCKERCFG} \
-e PREFIX=${PREFIX} \
-e DECKHOUSE_IMAGE_TAG=${DECKHOUSE_IMAGE_TAG} \
-e INITIAL_IMAGE_TAG=${INITIAL_IMAGE_TAG} \
-e KUBERNETES_VERSION=${KUBERNETES_VERSION} \
-e CRI=${CRI} \
-e PROVIDER=${PROVIDER:-not_provided} \
-e MASTER_CONNECTION_STRING=${SSH_MASTER_CONNECTION_STRING:-} \
-e LAYOUT=${LAYOUT:-not_provided} \
-e DHCTL_LOG_FILE="/tmp/$(basename ${dhctl_log_file})" \
-e SSH_KEY=${LAYOUT_SSH_KEY:-not_provided} \
-e LAYOUT_AZURE_SUBSCRIPTION_ID=${LAYOUT_AZURE_SUBSCRIPTION_ID:-not_provided} \
-e LAYOUT_AZURE_CLIENT_ID=${LAYOUT_AZURE_CLIENT_ID:-not_provided} \
-e LAYOUT_AZURE_CLIENT_SECRET=${LAYOUT_AZURE_CLIENT_SECRET:-not_provided} \
-e LAYOUT_AZURE_TENANT_ID=${LAYOUT_AZURE_TENANT_ID:-not_provided} \
-v $(pwd)/testing:/deckhouse/testing \
-v ${TMP_DIR_PATH}:/tmp \
--user $(id -u):$(id -u) \
-v /etc/group:/etc/group:ro \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/shadow:/etc/shadow:ro \
-w /deckhouse \
${INSTALL_IMAGE_NAME} \
bash /deckhouse/testing/cloud_layouts/script.sh cleanup
# </template: e2e_run_template>
- name: Save dhctl state
id: save_failed_cluster_state
if: ${{ failure() }}
uses: actions/[email protected]
with:
name: failed_cluster_state_azure_containerd_1_25
path: |
${{ steps.setup.outputs.tmp-dir-path}}/dhctl
${{ steps.setup.outputs.tmp-dir-path}}/*.tfstate
${{ steps.setup.outputs.tmp-dir-path}}/logs
- name: Save test results
if: ${{ steps.setup.outputs.dhctl-log-file }}
uses: actions/[email protected]
with:
name: test_output_azure_containerd_1_25
path: |
${{ steps.setup.outputs.dhctl-log-file}}*
${{ steps.setup.outputs.tmp-dir-path}}/logs
testing/cloud_layouts/
!testing/cloud_layouts/**/sshkey
- name: Cleanup temp directory
if: always()
env:
TMPPATH: ${{ steps.setup.outputs.tmppath}}
run: |
echo "Remove temporary directory '${TMPPATH}' ..."
if [[ -d "${TMPPATH}" && ${#TMPPATH} > 1 ]] ; then
rm -rf "${TMPPATH}"
else
echo Not a directory.
fi
# <template: send_alert_template>
- name: Check alerting credentials
id: check_alerting
if: always()
env:
KEY: ${{secrets.CLOUD_LAYOUT_TESTS_MADISON_KEY}}
run: |
if [[ -n $KEY ]]; then echo "has_credentials=true" >> $GITHUB_OUTPUT; fi
- name: Send alert on fail
if: ${{ steps.check_alerting.outputs.has_credentials == 'true' && (github.ref == 'refs/heads/main' && (cancelled() || failure())) }}
env:
CLOUD_LAYOUT_TESTS_MADISON_KEY: ${{secrets.CLOUD_LAYOUT_TESTS_MADISON_KEY}}
run: |
WORKFLOW_URL="${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
echo $WORKFLOW_URL
alertData=$(cat <<EOF
{
"labels": {
"cri": "Containerd",
"kube_version": "1.25",
"layout": "Standard",
"provider": "Azure",
"trigger": "CloudLayoutTestFailed",
"severity_level": 7
},
"annotations": {
"description": "Check Github workflow log for more information",
"plk_create_group_if_not_exists/cloudlayouttestfailed": "CloudLayoutTestFailedGroup",
"plk_grouped_by/cloudlayouttestfailed": "CloudLayoutTestFailedGroup",
"summary": "Cloud Layout Test failed",
"plk_link_url/job": "${WORKFLOW_URL}",
"plk_protocol_version": "1",
"plk_link_title_en/job": "Github job run"
}
}
EOF
)
for (( iter = 1; iter < 60; iter++ )); do
if curl -sS -X "POST" "https://madison.flant.com/api/events/custom/${CLOUD_LAYOUT_TESTS_MADISON_KEY}" -H 'Content-Type: application/json' -d "${alertData}"; then
exit 0
fi
echo "Alert was not sent. Wait 5 seconds before next attempt"
sleep 5
done
echo "Alert was not sent. Timeout"
exit 1
# </template: send_alert_template>
# </template: e2e_run_job_template>
# <template: e2e_run_job_template>
run_gcp_containerd_1_25:
name: "GCP, Containerd, Kubernetes 1.25"
needs:
- git_info
outputs:
ssh_master_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_master_connection_string }}
ssh_bastion_connection_string: ${{ steps.check_stay_failed_cluster.outputs.ssh_bastion_connection_string }}
run_id: ${{ github.run_id }}
# need for find state in artifact
cluster_prefix: ${{ steps.setup.outputs.dhctl-prefix }}
ran_for: "gcp;WithoutNAT;containerd;1.25"