Skip to content

Commit 0a77210

Browse files
committed
fix: ensure that all required env variables are set before running tests
Currently we don't set defaults for 2 mandatory env variables: CERT_MANAGER_VERSION and OPERATOR_IMAGE. If user doesn't define them manually before running tests, the execution will fail with some vague error messages. This commit ensures that the env variables always have default values.
1 parent b2e6b7a commit 0a77210

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ E2E_CONF_FILE ?= $(ROOT)/test/e2e/config/operator-dev.yaml
133133
E2E_CONF_FILE_ENVSUBST ?= $(ROOT)/test/e2e/config/operator-dev-envsubst.yaml
134134
SKIP_CLEANUP ?= false
135135
SKIP_CREATE_MGMT_CLUSTER ?= false
136+
CERT_MANAGER_VERSION ?= v1.7.1
136137

137138
# Relase
138139
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
@@ -353,7 +354,7 @@ docker-push-%:
353354

354355
.PHONY: docker-build-e2e
355356
docker-build-e2e:
356-
$(MAKE) CONTROLLER_IMG_TAG="gcr.io/k8s-staging-capi-operator/cluster-api-operator:dev" docker-build
357+
$(MAKE) CONTROLLER_IMG_TAG="$(CONTROLLER_IMG_TAG)" docker-build
357358

358359
.PHONY: set-manifest-pull-policy
359360
set-manifest-pull-policy:
@@ -464,7 +465,7 @@ test-e2e: $(KUSTOMIZE)
464465

465466
.PHONY: test-e2e-run
466467
test-e2e-run: $(GINKGO) $(ENVSUBST) ## Run e2e tests
467-
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
468+
OPERATOR_IMAGE=$(CONTROLLER_IMG_TAG) CERT_MANAGER_VERSION=$(CERT_MANAGER_VERSION) $(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
468469
$(GINKGO) -v -trace -tags=e2e --junit-report=junit_cluster_api_operator_e2e.xml --output-dir="${JUNIT_REPORT_DIR}" --no-color=$(GINKGO_NOCOLOR) $(GINKGO_ARGS) ./test/e2e -- \
469470
-e2e.artifacts-folder="$(ARTIFACTS)" \
470471
-e2e.config="$(E2E_CONF_FILE_ENVSUBST)" -e2e.components=$(ROOT)/$(RELEASE_DIR)/operator-components.yaml \

scripts/ci-e2e.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ source "${REPO_ROOT}/hack/ensure-go.sh"
2727
source "${REPO_ROOT}/hack/ensure-kind.sh"
2828

2929
# Build operator images
30-
export CERT_MANAGER_VERSION=v1.7.1
31-
export OPERATOR_IMAGE=gcr.io/k8s-staging-capi-operator/cluster-api-operator:dev
32-
3330
echo "+ Building CAPI operator image"
3431
make docker-build-e2e
3532

0 commit comments

Comments
 (0)