Skip to content

Commit a87e228

Browse files
authored
Merge pull request #163 from Jont828/skip-docker-push
🐛 Use local kind registry by default in e2e tests
2 parents 6c76b10 + f99119a commit a87e228

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
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.
400400
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
401401
$(MAKE) docker-build docker-push \
402402
test-e2e-run
403403

404+
.PHONY: test-e2e-local
405+
test-e2e-local: ## Run `docker-build` rule then run e2e tests.
406+
PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \
407+
$(MAKE) docker-build \
408+
test-e2e-run
409+
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

+7-3
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')
@@ -42,6 +43,9 @@ export GINKGO_NODES=10
4243
if [[ "${BUILD_MANAGER_IMAGE}" == "false" ]]; then
4344
# Load an existing image, skip docker-build and docker-push.
4445
make test-e2e-run
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)