Skip to content

Commit 0cac006

Browse files
committed
Use local kind registry by default in e2e tests
1 parent 6c76b10 commit 0cac006

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,19 @@ test-cover: ## Run unit and integration tests and generate a coverage report
396396

397397

398398
.PHONY: test-e2e
399-
test-e2e: ## Run "docker-build" and "docker-push" rules then run e2e tests.
399+
test-e2e: ## Run `docker-build` and `docker-push` rules then run e2e tests.
400+
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
401+
$(MAKE) docker-build docker-push \
402+
test-e2e-run
403+
404+
.PHONY: test-e2e-local
405+
test-e2e-local: ## Run `docker-build` rule then run e2e tests.
400406
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
401407
$(MAKE) docker-build docker-push \
402408
test-e2e-run
403409

404410
.PHONY: test-e2e-run-skip-manifest
405-
test-e2e-run-skip-manifest: $(GINKGO) $(ENVSUBST) generate-e2e-templates ## Run the end-to-end tests
411+
test-e2e-run-skip-manifest: $(GINKGO) $(ENVSUBST) generate-e2e-templates ## Run the end-to-end tests without updating the manifest.
406412
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST) && \
407413
$(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \
408414
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" \
@@ -413,7 +419,7 @@ test-e2e-run-skip-manifest: $(GINKGO) $(ENVSUBST) generate-e2e-templates ## Run
413419
-e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER)
414420

415421
.PHONY: test-e2e-run
416-
test-e2e-run:
422+
test-e2e-run: ## Run the end-to-end tests and set controller image and pull policy in the manifest.
417423
$(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/default/manager_image_patch.yaml"
418424
$(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent
419425
MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \

scripts/ci-e2e.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2525
# shellcheck source=hack/ensure-go.sh
2626
source "${REPO_ROOT}/hack/ensure-go.sh"
2727

28-
export LOCAL_ONLY=${LOCAL_ONLY:-"true"}
29-
export USE_LOCAL_KIND_REGISTRY=${USE_LOCAL_KIND_REGISTRY:-${LOCAL_ONLY}}
28+
export USE_LOCAL_KIND_REGISTRY=${USE_LOCAL_KIND_REGISTRY:-"true"}
3029
export BUILD_MANAGER_IMAGE=${BUILD_MANAGER_IMAGE:-"true"}
3130

32-
export REGISTRY=${REGISTRY:-"localhost:5000/ci-e2e"}
31+
if [[ "${USE_LOCAL_KIND_REGISTRY}" == "true" ]]; then
32+
export REGISTRY="localhost:5000/ci-e2e"
33+
fi
3334

3435
if [[ "${BUILD_MANAGER_IMAGE}" == "true" ]]; then
3536
defaultTag=$(date -u '+%Y%m%d%H%M%S')
@@ -41,7 +42,10 @@ export GINKGO_NODES=10
4142
# Image is configured as `${CONTROLLER_IMG}-${ARCH}:${TAG}` where `CONTROLLER_IMG` is defaulted to `${REGISTRY}/${IMAGE_NAME}`.
4243
if [[ "${BUILD_MANAGER_IMAGE}" == "false" ]]; then
4344
# Load an existing image, skip docker-build and docker-push.
44-
make test-e2e-run
45+
make test-e2e-skip-build-and-push
46+
elif [[ "${USE_LOCAL_KIND_REGISTRY}" == "true" ]]; then
47+
# Build an image with kind local registry, skip docker-push. REGISTRY is set to `localhost:5000/ci-e2e`. TAG is set to `$(date -u '+%Y%m%d%H%M%S')`.
48+
make test-e2e-local
4549
else
4650
# Build an image and push to the registry. TAG is set to `$(date -u '+%Y%m%d%H%M%S')`.
4751
make test-e2e

0 commit comments

Comments
 (0)