From a2e4a91504e82cc3bfa29c95c74321e9b488df7c Mon Sep 17 00:00:00 2001 From: "Per G. da Silva" Date: Thu, 19 Feb 2026 15:56:08 +0100 Subject: [PATCH] Fix experimental-to-experimental upgrade e2e to deploy baseline from main The ex2ex upgrade test was using the latest release as the baseline, but experimental features may not exist in any published release. Deploy from origin/main instead, so the upgrade path tests main -> PR for experimental manifests. - Add hack/test/deploy-from-main.sh to build and deploy from main - Add run-main-experimental Makefile target that invokes the new script - Add TEST_UPGRADE_EX2EX_E2E_TASKS that uses run-main-experimental - Wire test-upgrade-ex2ex-e2e to the new task list Co-Authored-By: Claude Opus 4.6 --- Makefile | 8 +++++-- hack/test/deploy-from-main.sh | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 hack/test/deploy-from-main.sh diff --git a/Makefile b/Makefile index 41397e9cc..77e9ba810 100644 --- a/Makefile +++ b/Makefile @@ -335,6 +335,10 @@ run-latest-release: @echo -e "\n\U23EC Using $(RELEASE_INSTALL) as release installer\n" curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/$(notdir $(RELEASE_INSTALL)) | bash -s +.PHONY: run-main-experimental +run-main-experimental: + KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ./hack/test/deploy-from-main.sh + .PHONY: pre-upgrade-setup pre-upgrade-setup: ./hack/test/pre-upgrade-setup.sh $(CATALOG_IMG) $(TEST_CLUSTER_CATALOG_NAME) $(TEST_CLUSTER_EXTENSION_NAME) @@ -345,6 +349,7 @@ post-upgrade-checks: TEST_UPGRADE_E2E_TASKS := kind-cluster run-latest-release image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean +TEST_UPGRADE_EX2EX_E2E_TASKS := kind-cluster run-main-experimental image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean .PHONY: test-upgrade-st2st-e2e test-upgrade-st2st-e2e: SOURCE_MANIFEST := $(STANDARD_MANIFEST) @@ -357,12 +362,11 @@ test-upgrade-st2st-e2e: $(TEST_UPGRADE_E2E_TASKS) #HELP Run upgrade (standard -> .PHONY: test-upgrade-ex2ex-e2e test-upgrade-ex2ex-e2e: SOURCE_MANIFEST := $(EXPERIMENTAL_MANIFEST) -test-upgrade-ex2ex-e2e: RELEASE_INSTALL := $(EXPERIMENTAL_RELEASE_INSTALL) test-upgrade-ex2ex-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-ex2ex-e2e test-upgrade-ex2ex-e2e: export MANIFEST := $(EXPERIMENTAL_RELEASE_MANIFEST) test-upgrade-ex2ex-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog test-upgrade-ex2ex-e2e: export TEST_CLUSTER_EXTENSION_NAME := test-package -test-upgrade-ex2ex-e2e: $(TEST_UPGRADE_E2E_TASKS) #HELP Run upgrade (experimental -> experimental) e2e tests on a local kind cluster +test-upgrade-ex2ex-e2e: $(TEST_UPGRADE_EX2EX_E2E_TASKS) #HELP Run upgrade (experimental -> experimental) e2e tests on a local kind cluster .PHONY: test-upgrade-st2ex-e2e test-upgrade-st2ex-e2e: SOURCE_MANIFEST := $(EXPERIMENTAL_MANIFEST) diff --git a/hack/test/deploy-from-main.sh b/hack/test/deploy-from-main.sh new file mode 100755 index 000000000..d8ad9b737 --- /dev/null +++ b/hack/test/deploy-from-main.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +# This script builds and deploys operator-controller from the main branch +# as the baseline for experimental-to-experimental upgrade tests. +# Instead of upgrading from the latest release, this allows comparing +# main -> PR for experimental features that may not exist in any release yet. +# +# Required environment variables (exported by Makefile): +# KIND_CLUSTER_NAME - name of the kind cluster +# OPCON_IMAGE_REPO - operator-controller image repository +# CATD_IMAGE_REPO - catalogd image repository + +MAIN_TAG=main + +# Save current HEAD so we can return after building from main +CURRENT_REF=$(git rev-parse HEAD) +cleanup() { + echo "Returning to ${CURRENT_REF}" + git checkout -f "${CURRENT_REF}" +} +trap cleanup EXIT + +# Fetch and checkout main +echo "Fetching and checking out origin/main" +git fetch origin main +git checkout FETCH_HEAD + +# Build images from main with a distinct tag so the upgrade +# (which uses the default 'devel' tag) triggers a real rollout +echo "Building images from main with tag '${MAIN_TAG}'" +make docker-build IMAGE_TAG="${MAIN_TAG}" + +# Load images into kind and deploy experimental manifests from main +echo "Loading images and deploying experimental manifests from main" +make kind-load IMAGE_TAG="${MAIN_TAG}" +make kind-deploy \ + SOURCE_MANIFEST=manifests/experimental.yaml \ + MANIFEST=operator-controller-experimental.yaml \ + HELM_SETTINGS="options.operatorController.deployment.image=${OPCON_IMAGE_REPO}:${MAIN_TAG} options.catalogd.deployment.image=${CATD_IMAGE_REPO}:${MAIN_TAG}"