Skip to content

[HOLD] 🌱 cleanup/registry #8324

[HOLD] 🌱 cleanup/registry

[HOLD] 🌱 cleanup/registry #8324

Workflow file for this run

name: e2e
on:
schedule:
- cron: '30 5,17 * * *' # run this every day at 5:30 and 17:30 UTC (00:30 and 12:30 ET)
push:
branches:
- master
pull_request:
workflow_dispatch:
merge_group:
jobs:
# Build the OLM image and save it as an artifact
build:
runs-on: ubuntu-latest
steps:
# checkout code and setup go
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
# build binaries and image for e2e test (includes experimental features)
- name: Build OLM Image
run: make e2e-build save-image
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: docker-images
path: "*.tar.gz"
# Run e2e tests in parallel jobs
# Take olm image from the previous stage
e2e:
needs: build
strategy:
fail-fast: false
matrix:
parallel-id: [0, 1, 2, 3, flakes]
runs-on: ubuntu-latest
env:
# absolute path to test artifacts directory
ARTIFACT_DIR: ${{ github.workspace }}/artifacts
E2E_TEST_CHUNK: ${{ matrix.parallel-id }}
E2E_NODES: 2
E2E_KUBECONFIG_ROOT: ${{ github.workspace }}/kubeconfigs
steps:
# checkout code and setup go
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: docker-images
path: images/
- name: Load Docker images
run: |
for image in images/*.tar.gz; do
echo "Loading image $image"
docker load -i $image
done
# set e2e environment variables
# Set ginkgo output and parallelism
- run: echo "GINKGO_OPTS=-output-dir ${ARTIFACT_DIR} -junit-report junit_e2e.xml -nodes ${E2E_NODES}" >> $GITHUB_ENV
# Setting -kubeconfig-root tells the e2e test suite to look for kubeconfigs
# in <kubeconfig-root>/kubeconfig-<node-number>
# This is used to run tests in parallel on multiple clusters as the current e2e
# test suite does not support running tests in parallel on a single cluster
- run: echo "E2E_OPTS=-kubeconfig-root=${E2E_KUBECONFIG_ROOT}" >> $GITHUB_ENV
# run e2e tests
# create artifacts directory
- run: mkdir -p ${ARTIFACT_DIR}
# deploy test clusters
- name: Deploy test cluster(s)
# create kubeconfig root and store the kubeconfig for each cluster within it as you create the clusters
# Add kind and helm options to specify kubeconfig location
# Deploy the new cluster and helm install olm for testing
run: |
mkdir -p ${E2E_KUBECONFIG_ROOT}
for i in $(seq 1 ${E2E_NODES}); do
KIND_CLUSTER_NAME="kind-olmv0-${i}" \
KIND_CREATE_OPTS="--kubeconfig=${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
HELM_INSTALL_OPTS="--kubeconfig ${E2E_KUBECONFIG_ROOT}/kubeconfig-${i}" \
make kind-create load-test-images deploy;
done
# run non-flakes if matrix-id is not 'flakes'
- name: Run e2e tests
if: ${{ matrix.parallel-id != 'flakes' }}
# calculate the number of chunks as the number of parallel jobs minus 1 (flakes job)
# use the split tool to split the test suite into chunks and run the chunk corresponding to the matrix-id
# focus on those tests and skip tests marked as FLAKE
run: |
E2E_TEST_NUM_CHUNKS=$(( ${{ strategy.job-total }} - 1 )) \
GINKGO_OPTS="${GINKGO_OPTS} -focus '$(go run ./test/e2e/split/... -chunks $E2E_TEST_NUM_CHUNKS -print-chunk $E2E_TEST_CHUNK ./test/e2e)' -skip '\[FLAKE\]'" \
make e2e;
# run e2e tests for flakes if matrix-id is 'flakes'
- name: Run flaky e2e tests
if: ${{ matrix.parallel-id == 'flakes' }}
# focus on tests marked as FLAKE
run: |
GINKGO_OPTS="${GINKGO_OPTS} -focus '\[FLAKE\]'" make e2e
# archive test results
- name: Archive Test Artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: e2e-test-output-${{ (github.event.pull_request.head.sha || github.sha) }}-${{ github.run_id }}-${{ matrix.parallel-id }}
path: ${{ env.ARTIFACT_DIR }}/*
# TODO: create job to combine test artifacts using code in https://github.com/operator-framework/operator-lifecycle-manager/pull/1476
e2e-tests:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: e2e
steps:
- run: |
echo "Matrix result: ${{ needs.e2e.result }}"
- name: check individual matrix results
if: ${{ needs.e2e.result == 'failure' }}
run: |
echo 'Failure: at least one e2e matrix job has failed'
exit 1