Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Makefile to support customizable build tool #215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
go-version: ${{ matrix.go }}

- name: Build
run: make docker-build
run: make operator-build

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

- name: Push
run: make docker-push
run: make operator-push

publish-bundle:
name: Bundle Image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
go-version: ${{ matrix.go }}

- name: Build
run: make docker-build
run: make operator-build

validate-bundle:
name: Validate Operator Bundle
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ build: generate fmt vet golangci-lint kube-linter ## Build manager binary.
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

docker-build: generate fmt vet golangci-lint kube-linter ## Build docker image with the manager.
docker build -t ${IMG} .
operator-build: generate fmt vet golangci-lint kube-linter ## Build docker image with the manager.
vbnrh marked this conversation as resolved.
Show resolved Hide resolved
${BUILD_TOOL} build -t ${IMG} .

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

##@ Deployment

Expand Down Expand Up @@ -117,19 +117,19 @@ endif

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

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
$(MAKE) operator-push IMG=$(BUNDLE_IMG)

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

.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)
$(MAKE) operator-push IMG=$(CATALOG_IMG)

##@ Actions

Expand Down
1 change: 1 addition & 0 deletions hack/make/vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MULTICLUSTER_CONSOLE_IMG_TAG ?= latest
IMG ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)
MULTICLUSTER_CONSOLE_IMG ?= ${IMAGE_REGISTRY}/$(REGISTRY_NAMESPACE)/$(MULTICLUSTER_CONSOLE_IMG_NAME):$(MULTICLUSTER_CONSOLE_IMG_TAG)

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