Skip to content

Commit 197c984

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

File tree

2 files changed

+72
-1
lines changed

2 files changed

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

0 commit comments

Comments
 (0)