diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 0ba645efe6..5d34cdd474 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -13,8 +13,6 @@ jobs: # Build the OLM image and save it as an artifact build: runs-on: ubuntu-latest - outputs: - sha: ${{ steps.vars.outputs.sha }} steps: # checkout code and setup go - uses: actions/checkout@v4 @@ -22,15 +20,13 @@ jobs: with: go-version-file: "go.mod" # build binaries and image for e2e test (includes experimental features) - - name: Build controller image - run: make e2e-build - - name: Save image - run: docker save quay.io/operator-framework/olm:local -o olm-image.tar - - name: Upload Docker image as artifact + - name: Build OLM Image + run: make e2e-build save-image + - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: olm-image.tar - path: olm-image.tar + name: docker-images + path: "*.tar.gz" # Run e2e tests in parallel jobs # Take olm image from the previous stage @@ -53,14 +49,17 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: "go.mod" - - # load the olm image - - name: Load OLM Docker image + - name: Download build artifacts uses: actions/download-artifact@v4 with: - name: olm-image.tar - path: . - - run: docker load < olm-image.tar + 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 @@ -87,7 +86,7 @@ jobs: 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 deploy; + make kind-create load-test-images deploy; done # run non-flakes if matrix-id is not 'flakes' diff --git a/Makefile b/Makefile index fbb19078be..d90848d3ad 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,12 @@ image: export GOOS = linux image: clean build #HELP Build image image for linux on host architecture docker build -t $(IMAGE_REPO):$(IMAGE_TAG) -f Dockerfile bin +.PHONY: save-image +TARGZ_FILE ?= olm-image.tar.gz +save-image: + docker save $(IMAGE_REPO):$(IMAGE_TAG) | gzip > "$(TARGZ_FILE)" + + .PHONE: build-e2e-fixture-images build-e2e-fixture-images: #HELP Build images for e2e testing ./scripts/e2e_test_fixtures.sh @@ -152,6 +158,7 @@ build-e2e-fixture-images: #HELP Build images for e2e testing .PHONY: e2e-build # the e2e and experimental_metrics tags are required to get e2e tests to pass # search the code for go:build e2e or go:build experimental_metrics to see where these tags are used + e2e-build: export GO_BUILD_TAGS += e2e experimental_metrics #HELP Build image for e2e testing e2e-build: IMAGE_TAG = local e2e-build: image @@ -217,7 +224,7 @@ kind-create: kind-clean #HELP Create a new kind cluster $KIND_CLUSTER_NAME (defa .PHONY: load-test-images export REGISTRY ?= localhost:5001 load-test-images: #HELP Load the OLM images into the kind cluster's registry - ./scripts/e2e_test_fixtures.sh --push-to="localhost:5001" + ./scripts/e2e_test_fixtures.sh --push-to="$(REGISTRY)" .PHONY: deploy OLM_IMAGE ?= $(IMAGE_REPO):$(IMAGE_TAG)