Skip to content

Commit d04d559

Browse files
(fix): Experimental E2E Upgrade by testing main to pr changes
1 parent 1355ff7 commit d04d559

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ test-extension-developer-e2e: run-internal image-registry extension-developer-e2
305305
run-latest-release:
306306
curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/$(notdir $(RELEASE_INSTALL)) | bash -s
307307

308+
.PHONY: run-main-install
309+
run-main-install:
310+
KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ./hack/test/install-from-main.sh $(notdir $(SOURCE_MANIFEST))
311+
308312
.PHONY: pre-upgrade-setup
309313
pre-upgrade-setup:
310314
./hack/test/pre-upgrade-setup.sh $(CATALOG_IMG) $(TEST_CLUSTER_CATALOG_NAME) $(TEST_CLUSTER_EXTENSION_NAME)
@@ -315,6 +319,7 @@ post-upgrade-checks:
315319

316320

317321
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
322+
TEST_UPGRADE_EXPERIMENTAL_E2E_TASKS := kind-cluster run-main-install image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean
318323

319324
.PHONY: test-upgrade-e2e
320325
test-upgrade-e2e: SOURCE_MANIFEST := $(STANDARD_MANIFEST)
@@ -332,7 +337,7 @@ test-upgrade-experimental-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-
332337
test-upgrade-experimental-e2e: export MANIFEST := $(EXPERIMENTAL_RELEASE_MANIFEST)
333338
test-upgrade-experimental-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog
334339
test-upgrade-experimental-e2e: export TEST_CLUSTER_EXTENSION_NAME := test-package
335-
test-upgrade-experimental-e2e: $(TEST_UPGRADE_E2E_TASKS) #HELP Run upgrade e2e tests on a local kind cluster
340+
test-upgrade-experimental-e2e: $(TEST_UPGRADE_EXPERIMENTAL_E2E_TASKS) #HELP Run upgrade e2e tests on a local kind cluster
336341

337342

338343
.PHONY: e2e-coverage

hack/test/install-from-main.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
4+
set -euo pipefail
5+
6+
# This script is used to install OLMv1 from the main branch by:
7+
# 1. Checking out main branch in a temporary location
8+
# 2. Building container images from main source code
9+
# 3. Loading images into the kind cluster
10+
# 4. Deploying manifests from main
11+
12+
13+
help="install-from-main.sh installs OLMv1 from main branch source code
14+
15+
Usage:
16+
install-from-main.sh [MANIFEST_NAME]
17+
18+
Example:
19+
install-from-main.sh experimental.yaml
20+
install-from-main.sh standard.yaml
21+
22+
Environment variables:
23+
KIND_CLUSTER_NAME: Name of the kind cluster (required)
24+
"
25+
26+
if [[ "$#" -ne 1 ]]; then
27+
echo "Illegal number of arguments passed"
28+
echo "${help}"
29+
exit 1
30+
fi
31+
32+
if [[ -z "${KIND_CLUSTER_NAME:-}" ]]; then
33+
echo "Error: KIND_CLUSTER_NAME environment variable must be set"
34+
exit 1
35+
fi
36+
37+
MANIFEST_NAME=$1
38+
39+
# Create temporary directory for main branch checkout
40+
TEMP_DIR=$(mktemp -d)
41+
trap 'echo "Cleaning up ${TEMP_DIR}"; rm -rf "${TEMP_DIR}"' EXIT
42+
43+
echo "Cloning main branch to temporary directory..."
44+
# Clone from GitHub (works in CI and locally)
45+
git clone --depth 1 --branch main https://github.com/operator-framework/operator-controller.git "${TEMP_DIR}"
46+
47+
cd "${TEMP_DIR}"
48+
49+
echo "Building images from main branch source code..."
50+
make docker-build
51+
52+
echo "Loading images into kind cluster ${KIND_CLUSTER_NAME}..."
53+
make kind-load KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME}"
54+
55+
echo "Deploying manifests from main branch..."
56+
# Extract CERT_MGR_VERSION from main branch Makefile
57+
# Expected Makefile line format: export CERT_MGR_VERSION := <value>
58+
CERT_MGR_VERSION_FROM_MAIN=$(grep "^export CERT_MGR_VERSION" Makefile | awk -F'[ :=]+' '{print $NF}')
59+
export CERT_MGR_VERSION="${CERT_MGR_VERSION_FROM_MAIN:-v1.18.2}"
60+
export MANIFEST="https://raw.githubusercontent.com/operator-framework/operator-controller/main/manifests/${MANIFEST_NAME}"
61+
export DEFAULT_CATALOG="https://raw.githubusercontent.com/operator-framework/operator-controller/main/manifests/default-catalogs.yaml"
62+
export INSTALL_DEFAULT_CATALOGS="${INSTALL_DEFAULT_CATALOGS:-false}"
63+
64+
curl -L -s https://raw.githubusercontent.com/operator-framework/operator-controller/main/scripts/install.tpl.sh | \
65+
envsubst '$$DEFAULT_CATALOG,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' | bash -s
66+
67+
echo "Successfully installed OLMv1 from main branch"
68+

0 commit comments

Comments
 (0)