Skip to content

Commit 2d953de

Browse files
committed
changed location for the CONTAINER_TOOL declaration
1 parent 1031ca8 commit 2d953de

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ func (f *Makefile) SetTemplateDefaults() error {
6565
}
6666

6767
const makefileTemplate = `
68+
# Container tool to use for building and pushing images
69+
CONTAINER_TOOL ?= docker
70+
6871
# Image URL to use all building/pushing image targets
6972
IMG ?= {{ .Image }}
7073
@@ -96,11 +99,11 @@ run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/c
9699
97100
.PHONY: docker-build
98101
docker-build: ## Build docker image with the manager.
99-
docker build -t ${IMG} .
102+
$(CONTAINER_TOOL) build -t ${IMG} .
100103
101104
.PHONY: docker-push
102105
docker-push: ## Push docker image with the manager.
103-
docker push ${IMG}
106+
$(CONTAINER_TOOL) push ${IMG}
104107
105108
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
106109
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -111,10 +114,10 @@ docker-push: ## Push docker image with the manager.
111114
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
112115
.PHONY: docker-buildx
113116
docker-buildx: ## Build and push docker image for the manager for cross-platform support
114-
- docker buildx create --name project-v3-builder
115-
docker buildx use project-v3-builder
116-
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
117-
- docker buildx rm project-v3-builder
117+
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
118+
$(CONTAINER_TOOL) buildx use project-v3-builder
119+
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
120+
- $(CONTAINER_TOOL) buildx rm project-v3-builder
118121
119122
##@ Deployment
120123

internal/plugins/manifests/v2/init.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
230230
`
231231

232232
makefileBundleFragmentNonGo = `
233-
# Container tool to use for building images
234-
CONTAINER_TOOL ?= docker
235233
236234
.PHONY: bundle
237235
bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.

testdata/helm/memcached-operator/Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ endif
5050
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
5151
OPERATOR_SDK_VERSION ?= v1.39.2
5252

53+
# Container tool to use for building and pushing images
54+
CONTAINER_TOOL ?= docker
55+
5356
# Image URL to use all building/pushing image targets
5457
IMG ?= controller:latest
5558

@@ -81,11 +84,11 @@ run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/c
8184

8285
.PHONY: docker-build
8386
docker-build: ## Build docker image with the manager.
84-
docker build -t ${IMG} .
87+
$(CONTAINER_TOOL) build -t ${IMG} .
8588

8689
.PHONY: docker-push
8790
docker-push: ## Push docker image with the manager.
88-
docker push ${IMG}
91+
$(CONTAINER_TOOL) push ${IMG}
8992

9093
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
9194
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -96,10 +99,10 @@ docker-push: ## Push docker image with the manager.
9699
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
97100
.PHONY: docker-buildx
98101
docker-buildx: ## Build and push docker image for the manager for cross-platform support
99-
- docker buildx create --name project-v3-builder
100-
docker buildx use project-v3-builder
101-
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
102-
- docker buildx rm project-v3-builder
102+
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
103+
$(CONTAINER_TOOL) buildx use project-v3-builder
104+
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
105+
- $(CONTAINER_TOOL) buildx rm project-v3-builder
103106

104107
##@ Deployment
105108

@@ -171,8 +174,6 @@ OPERATOR_SDK = $(shell which operator-sdk)
171174
endif
172175
endif
173176

174-
# Container tool to use for building images
175-
CONTAINER_TOOL ?= docker
176177

177178
.PHONY: bundle
178179
bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.

0 commit comments

Comments
 (0)