Skip to content

Commit 904404a

Browse files
authored
Merge pull request #301 from Jont828/makefile-registry-default
🌱 Set REGISTRY to localhost:5000 by default if gcloud project name is not set
2 parents 5cc5319 + ce6e3db commit 904404a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,18 @@ HELM_BIN := helm
199199
HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER)
200200

201201
# Define Docker related variables. Releases should modify and double check these vars.
202-
REGISTRY ?= gcr.io/$(shell gcloud config get-value project)
202+
ifneq ($(shell command -v gcloud),)
203+
GCLOUD_PROJECT := $(shell gcloud config get-value project 2>/dev/null)
204+
ifneq ($(GCLOUD_PROJECT),)
205+
REGISTRY ?= gcr.io/$(GCLOUD_PROJECT)
206+
endif
207+
endif
208+
209+
# If REGISTRY is not set, default to localhost:5000 to use the kind registry.
210+
ifndef REGISTRY
211+
REGISTRY ?= localhost:5000
212+
endif
213+
203214
PROD_REGISTRY ?= registry.k8s.io/cluster-api-helm
204215

205216
STAGING_REGISTRY ?= gcr.io/k8s-staging-cluster-api-helm

0 commit comments

Comments
 (0)