Skip to content

Commit d9a23ce

Browse files
Merge pull request #215 from vbnrh/makefile-build-changes
Refactor Makefile to support customizable build tool
2 parents acfbd5a + 9739735 commit d9a23ce

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

.github/workflows/publish-images.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
go-version: ${{ matrix.go }}
3232

3333
- name: Build
34-
run: make docker-build
34+
run: make operator-build
3535

3636
- name: Login to Quay
3737
uses: docker/login-action@v1
@@ -41,7 +41,7 @@ jobs:
4141
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
4242

4343
- name: Push
44-
run: make docker-push
44+
run: make operator-push
4545

4646
publish-bundle:
4747
name: Bundle Image

.github/workflows/test-and-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
go-version: ${{ matrix.go }}
8585

8686
- name: Build
87-
run: make docker-build
87+
run: make operator-build
8888

8989
validate-bundle:
9090
name: Validate Operator Bundle

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ build: generate fmt vet golangci-lint kube-linter ## Build manager binary.
7474
run: manifests generate fmt vet ## Run a controller from your host.
7575
go run ./main.go
7676

77-
docker-build: generate fmt vet golangci-lint kube-linter ## Build docker image with the manager.
78-
docker build -t ${IMG} .
77+
operator-build: generate fmt vet golangci-lint kube-linter ## Build docker image with the manager.
78+
${BUILD_TOOL} build -t ${IMG} .
7979

80-
docker-push: ## Push docker image with the manager.
81-
docker push ${IMG}
80+
operator-push: ## Push docker image with the manager.
81+
${BUILD_TOOL} push ${IMG}
8282

8383
##@ Deployment
8484

@@ -117,19 +117,19 @@ endif
117117

118118
.PHONY: bundle-build
119119
bundle-build: bundle ## Build the bundle image.
120-
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
120+
${BUILD_TOOL} build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
121121

122122
.PHONY: bundle-push
123123
bundle-push: ## Push the bundle image.
124-
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
124+
$(MAKE) operator-push IMG=$(BUNDLE_IMG)
125125

126126
.PHONY: catalog-build
127127
catalog-build: opm ## Build a catalog image.
128-
$(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
128+
$(OPM) index add --container-tool ${BUILD_TOOL} --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
129129

130130
.PHONY: catalog-push
131131
catalog-push: ## Push a catalog image.
132-
$(MAKE) docker-push IMG=$(CATALOG_IMG)
132+
$(MAKE) operator-push IMG=$(CATALOG_IMG)
133133

134134
##@ Actions
135135

hack/make/vars.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ MULTICLUSTER_CONSOLE_IMG_TAG ?= latest
2222
IMG ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)
2323
MULTICLUSTER_CONSOLE_IMG ?= ${IMAGE_REGISTRY}/$(REGISTRY_NAMESPACE)/$(MULTICLUSTER_CONSOLE_IMG_NAME):$(MULTICLUSTER_CONSOLE_IMG_TAG)
2424

25+
BUILD_TOOL ?= docker
2526
# CHANNELS define the bundle channels used in the bundle.
2627
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
2728
# To re-generate a bundle for other specific channels without changing the standard setup, you can:

0 commit comments

Comments
 (0)