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}"