Skip to content

Commit

Permalink
update e2e gha
Browse files Browse the repository at this point in the history
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
  • Loading branch information
Per Goncalves da Silva committed Jul 1, 2024
1 parent 0848489 commit 7aede27
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,20 @@ 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
- uses: actions/setup-go@v5
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
Expand All @@ -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
Expand All @@ -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'
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,20 @@ 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

.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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7aede27

Please sign in to comment.