Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
40 changes: 40 additions & 0 deletions hack/test/deploy-from-main.sh
Original file line number Diff line number Diff line change
@@ -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

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script uses KIND_CLUSTER_NAME, OPCON_IMAGE_REPO, and CATD_IMAGE_REPO but does not validate that these required environment variables are set. If any are missing, the script will fail with unclear error messages. Following the pattern used in other scripts like hack/tools/update-tls-profiles.sh and hack/test/pre-upgrade-setup.sh, add validation checks after this line to verify all required variables are set before proceeding.

Suggested change
# Validate required environment variables
: "${KIND_CLUSTER_NAME:?Environment variable KIND_CLUSTER_NAME must be set}"
: "${OPCON_IMAGE_REPO:?Environment variable OPCON_IMAGE_REPO must be set}"
: "${CATD_IMAGE_REPO:?Environment variable CATD_IMAGE_REPO must be set}"

Copilot uses AI. Check for mistakes.
# Save current HEAD so we can return after building from main
CURRENT_REF=$(git rev-parse HEAD)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup function uses 'git checkout -f' which will discard any uncommitted changes in the working directory when returning to the original ref. This could cause unexpected data loss if the script is run in a dirty working directory. Consider checking for uncommitted changes before proceeding, or at minimum document this behavior in the script comments so users are aware of this side effect.

Suggested change
CURRENT_REF=$(git rev-parse HEAD)
CURRENT_REF=$(git rev-parse HEAD)
# NOTE: The cleanup step uses 'git checkout -f' to ensure we always return
# to the original ref. This will discard any uncommitted changes in the
# working directory when the script exits.

Copilot uses AI. Check for mistakes.
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 \
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the Makefile's EXPERIMENTAL_MANIFEST variable instead of hardcoding "manifests/experimental.yaml". While both currently resolve to the same path, using the variable would ensure consistency with other parts of the codebase and make the script more resilient to future changes in manifest organization. The variable would need to be exported from the Makefile or passed as an argument.

Suggested change
SOURCE_MANIFEST=manifests/experimental.yaml \
SOURCE_MANIFEST="${EXPERIMENTAL_MANIFEST:-manifests/experimental.yaml}" \

Copilot uses AI. Check for mistakes.
MANIFEST=operator-controller-experimental.yaml \
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the Makefile's EXPERIMENTAL_RELEASE_MANIFEST variable instead of hardcoding "operator-controller-experimental.yaml". While both currently resolve to the same filename, using the variable would ensure consistency with other parts of the codebase and make the script more resilient to future changes in manifest naming conventions. The variable would need to be exported from the Makefile or passed as an argument.

Suggested change
MANIFEST=operator-controller-experimental.yaml \
MANIFEST="${EXPERIMENTAL_RELEASE_MANIFEST:-operator-controller-experimental.yaml}" \

Copilot uses AI. Check for mistakes.
HELM_SETTINGS="options.operatorController.deployment.image=${OPCON_IMAGE_REPO}:${MAIN_TAG} options.catalogd.deployment.image=${CATD_IMAGE_REPO}:${MAIN_TAG}"
Loading