Skip to content

Commit cd10ce5

Browse files
committed
make: add upgrade testing support
Add variables and targets to support operator upgrade e2e testing. RELEASED_OPERATOR_TAG and RELEASED_OPERATOR_IMG control which released version to test against. The push-released-operator-image target pulls the released image and pushes it to the bink registry. deploy-bink runs this automatically when RELEASED_OPERATOR_IMG is set. Example usage: make deploy-bink RELEASED_OPERATOR_IMG=ghcr.io/bootc-dev/bootc-operator:v0.1.0 make e2e RUN=TestOperatorUpgrade RELEASED_OPERATOR_TAG=v0.1.0 \ RELEASED_OPERATOR_IMG=ghcr.io/bootc-dev/bootc-operator:v0.1.0 V=1 Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 81dccad commit cd10ce5

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎Makefile‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ BINK_NODE_DISK_IMAGE ?= ghcr.io/bootc-dev/bink/node:v$(DEFAULT_KUBE_MINOR)-fedor
1717
BINK_LOCAL_REGISTRY_NODE_IMAGE ?= registry.cluster.local:5000/node
1818
E2E_REGISTRY_USER ?= e2e-user
1919
E2E_REGISTRY_PASSWORD ?= e2e-password
20+
# Released operator for upgrade testing (set to run TestOperatorUpgrade).
21+
# RELEASED_OPERATOR_TAG: GitHub release tag to download install.yaml from.
22+
# RELEASED_OPERATOR_IMG: container image to use (defaults to upstream, override for downstream).
23+
# Example: RELEASED_OPERATOR_TAG=v0.1.0
24+
# RELEASED_OPERATOR_IMG=ghcr.io/bootc-dev/bootc-operator:v0.1.0
25+
RELEASED_OPERATOR_TAG ?=
26+
RELEASED_OPERATOR_IMG ?=
27+
IMG_BINK_RELEASED ?= registry.cluster.local:5000/bootc-operator-released:latest
2028
# YEAR defines the year value used for substituting the YEAR placeholder in the boilerplate header.
2129
YEAR ?= $(shell date +%Y)
2230

@@ -106,6 +114,8 @@ e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN=<regex>
106114
E2E_NODE_IMAGE_UPDATE_DIGEST=$$(skopeo inspect --tls-verify=false docker://localhost:5000/node:update | jq -r '.Digest') \
107115
E2E_NODE_IMAGE_UPDATE2_DIGEST=$$(skopeo inspect --tls-verify=false docker://localhost:5000/node:update2 | jq -r '.Digest') \
108116
E2E_REGISTRY_USER=$(E2E_REGISTRY_USER) E2E_REGISTRY_PASSWORD=$(E2E_REGISTRY_PASSWORD) \
117+
$(if $(RELEASED_OPERATOR_TAG),E2E_OPERATOR_RELEASE_TAG=$(RELEASED_OPERATOR_TAG)) \
118+
$(if $(RELEASED_OPERATOR_IMG),E2E_OPERATOR_RELEASED_IMG=$(IMG_BINK_RELEASED)) \
109119
go test -timeout 40m -count=1 $(if $(V),-v) $(if $(RUN),-run $(RUN)) .
110120

111121
# EKS e2e settings
@@ -167,6 +177,15 @@ build-update-image: ## Build derived node images for update testing and push to
167177
podman build -t localhost:5000/node:update2 -f - .
168178
podman push --tls-verify=false localhost:5000/node:update2
169179

180+
.PHONY: push-released-operator-image
181+
push-released-operator-image: ## Pull released operator image and push to bink registry for upgrade testing.
182+
@if [ -z "$(RELEASED_OPERATOR_IMG)" ]; then \
183+
echo "Error: RELEASED_OPERATOR_IMG must be set (e.g. ghcr.io/bootc-dev/bootc-operator:v0.1.0)"; \
184+
exit 1; \
185+
fi
186+
podman pull $(RELEASED_OPERATOR_IMG)
187+
podman push --tls-verify=false $(RELEASED_OPERATOR_IMG) localhost:5000/bootc-operator-released:latest
188+
170189
##@ Deployment
171190

172191
ifndef ignore-not-found
@@ -219,7 +238,7 @@ start-bink: seed-node-image ## Start a bink cluster (idempotent).
219238
kubectl --kubeconfig $(KUBECONFIG_BINK) wait --for=condition=Ready node/controller --timeout=5m
220239

221240
.PHONY: deploy-bink
222-
deploy-bink: start-bink build-update-image kustomize ## Deploy to a bink cluster (requires: buildimg).
241+
deploy-bink: start-bink build-update-image $(if $(RELEASED_OPERATOR_IMG),push-released-operator-image) kustomize ## Deploy to a bink cluster (requires: buildimg).
223242
podman push --tls-verify=false $(IMG) localhost:5000/bootc-operator-e2e:latest
224243
# On re-deploy, restart the rollout to force a re-pull of the :latest tag.
225244
# On fresh deploy, skip the restart -- the pod is already pulling the correct image.

0 commit comments

Comments
 (0)