99 workflow_dispatch :
1010 merge_group :
1111jobs :
12+
13+ # Build the OLM image and save it as an artifact
1214 build :
1315 runs-on : ubuntu-latest
1416 outputs :
1517 sha : ${{ steps.vars.outputs.sha }}
1618 steps :
19+ # checkout code and setup go
1720 - uses : actions/checkout@v4
1821 - uses : actions/setup-go@v5
1922 with :
2023 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
2928 run : docker save quay.io/operator-framework/olm:local -o olm-image.tar
3029 - name : Upload Docker image as artifact
3130 uses : actions/upload-artifact@v4
3231 with :
3332 name : olm-image.tar
3433 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 :
3638 needs : build
3739 strategy :
3840 fail-fast : false
3941 matrix :
40- parallel-id : [0, 1, 2, 3, flake ]
42+ parallel-id : [0, 1, 2, 3, flakes ]
4143 runs-on : ubuntu-latest
4244 env :
45+ # absolute path to test artifacts directory
4346 ARTIFACT_DIR : ${{ github.workspace }}/artifacts
47+ E2E_TEST_CHUNK : ${{ matrix.parallel-id }}
48+ E2E_NODES : 2
49+ E2E_KUBECONFIG_ROOT : $${{ github.workspace }}/kubeconfigs
4450 steps :
51+ # checkout code and setup go
4552 - uses : actions/checkout@v4
4653 - uses : actions/setup-go@v5
4754 with :
4855 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
5259 uses : actions/download-artifact@v4
5360 with :
5461 name : olm-image.tar
5562 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)
5775 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'
6086 - 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
67103 if : ${{ always() }}
68104 uses : actions/upload-artifact@v4
69105 with :
@@ -74,12 +110,12 @@ jobs:
74110 e2e-tests :
75111 if : ${{ always() }}
76112 runs-on : ubuntu-latest
77- needs : e2e
113+ needs : run- e2e
78114 steps :
79115 - run : |
80116 echo "Matrix result: ${{ needs.e2e.result }}"
81117 - name : check individual matrix results
82118 if : ${{ needs.e2e.result == 'failure' }}
83119 run : |
84120 echo 'Failure: at least one e2e matrix job has failed'
85- exit 1
121+ exit 1
0 commit comments