9
9
workflow_dispatch :
10
10
merge_group :
11
11
jobs :
12
+
13
+ # Build the OLM image and save it as an artifact
12
14
build :
13
15
runs-on : ubuntu-latest
14
16
outputs :
15
17
sha : ${{ steps.vars.outputs.sha }}
16
18
steps :
19
+ # checkout code and setup go
17
20
- uses : actions/checkout@v4
18
21
- uses : actions/setup-go@v5
19
22
with :
20
23
go-version-file : " go.mod"
21
- check-latest : true
22
- cache-dependency-path : " **/*.sum"
23
- - name : Build
24
- run : make e2e-local-build
25
- - name : Output Variables
26
- id : vars
27
- run : echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
28
- - name : Save docker image
24
+ # build binaries and image for e2e test (includes experimental features)
25
+ - name : Build controller image
26
+ run : make e2e-build
27
+ - name : Save image
29
28
run : docker save quay.io/operator-framework/olm:local -o olm-image.tar
30
29
- name : Upload Docker image as artifact
31
30
uses : actions/upload-artifact@v4
32
31
with :
33
32
name : olm-image.tar
34
33
path : olm-image.tar
35
- e2e :
34
+
35
+ # Run e2e tests in parallel jobs
36
+ # Take olm image from the previous stage
37
+ run-e2e :
36
38
needs : build
37
39
strategy :
38
40
fail-fast : false
39
41
matrix :
40
- parallel-id : [0, 1, 2, 3, flake ]
42
+ parallel-id : [0, 1, 2, 3, flakes ]
41
43
runs-on : ubuntu-latest
42
44
env :
45
+ # absolute path to test artifacts directory
43
46
ARTIFACT_DIR : ${{ github.workspace }}/artifacts
47
+ E2E_TEST_CHUNK : ${{ matrix.parallel-id }}
48
+ E2E_NODES : 2
49
+ E2E_KUBECONFIG_ROOT : $${{ github.workspace }}/kubeconfigs
44
50
steps :
51
+ # checkout code and setup go
45
52
- uses : actions/checkout@v4
46
53
- uses : actions/setup-go@v5
47
54
with :
48
55
go-version-file : " go.mod"
49
- check-latest : true
50
- cache-dependency-path : " **/*.sum "
51
- - name : Download Docker image from artifacts
56
+
57
+ # load the olm image
58
+ - name : Load OLM Docker image
52
59
uses : actions/download-artifact@v4
53
60
with :
54
61
name : olm-image.tar
55
62
path : .
56
- - name : Load Docker image
63
+ - run : docker load < olm-image.tar
64
+
65
+ # set e2e environment variables
66
+ - run : echo "GINKGO_E2E_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
67
+ - run : echo "E2E_OPTS=-output-dir -test-data-dir=./testdata -gather-artifacts-script-path=./collect-ci-artifacts.sh -kubeconfig-root=${E2E_KUBECONFIG_ROOT}" >> $GITHUB_ENV
68
+
69
+ # run e2e tests
70
+ # create artifacts directory
71
+ - run : mkdir -p ${ARTIFACT_DIR}
72
+
73
+ # deploy test clusters
74
+ - name : Deploy test cluster(s)
57
75
run : |
58
- docker load < olm-image.tar
59
- - run : mkdir -p '${{ env.ARTIFACT_DIR }}'
76
+ mkdir -p ${E2E_KUBECONFIG_ROOT}
77
+ for i in $(seq 1 ${E2E_NODES}); do
78
+ export KUBECONFIG=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}
79
+ export KIND_CLUSTER_NAME=kind-olmv0-${i}
80
+ export KIND_CREATE_OPTS="--kubeconfig=${KUBECONFIG}"
81
+ export HELM_INSTALL_OPTS="--kubeconfig ${KUBECONFIG}"
82
+ make kind-create deploy
83
+ done
84
+
85
+ # run non-flakes if matrix-id is not 'flakes'
60
86
- name : Run e2e tests
61
- if : ${{ matrix.parallel-id != 'flake' }}
62
- run : make e2e-local E2E_TEST_CHUNK=${{ matrix.parallel-id }} E2E_TEST_NUM_CHUNKS=${{ strategy.job-total }} E2E_NODES=2 ARTIFACT_DIR='${{ env.ARTIFACT_DIR }}' SKIP='\[FLAKE\]'
63
- - name : Run e2e tests for flakes
64
- if : ${{ matrix.parallel-id == 'flake' }}
65
- run : make e2e-local E2E_NODES=2 ARTIFACT_DIR='${{ env.ARTIFACT_DIR }}' TEST='\[FLAKE\]'
66
- - name : Archive Test Artifacts # test results, failed or not, are always uploaded.
87
+ if : ${{ matrix.parallel-id != 'flakes' }}
88
+ run : |
89
+ # subtract 1 from total jobs to account for the flakes job
90
+ export E2E_TEST_NUM_CHUNKS=$(( ${{ strategy.job-total }} - 1 ))
91
+ export GINKGO_E2E_OPTS="${GINKGO_E2E_OPTS} -focus $(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e) -skip '\[FLAKE\]'"
92
+ make e2e
93
+
94
+ # run e2e tests for flakes if matrix-id is 'flakes'
95
+ - name : Run flaky e2e tests
96
+ if : ${{ matrix.parallel-id == 'flakes' }}
97
+ run : |
98
+ export GINKGO_E2E_OPTS="-focus '\[FLAKE\]'"
99
+ make e2e
100
+
101
+ # archive test results
102
+ - name : Archive Test Artifacts
67
103
if : ${{ always() }}
68
104
uses : actions/upload-artifact@v4
69
105
with :
@@ -74,12 +110,12 @@ jobs:
74
110
e2e-tests :
75
111
if : ${{ always() }}
76
112
runs-on : ubuntu-latest
77
- needs : e2e
113
+ needs : run- e2e
78
114
steps :
79
115
- run : |
80
116
echo "Matrix result: ${{ needs.e2e.result }}"
81
117
- name : check individual matrix results
82
118
if : ${{ needs.e2e.result == 'failure' }}
83
119
run : |
84
120
echo 'Failure: at least one e2e matrix job has failed'
85
- exit 1
121
+ exit 1
0 commit comments