Skip to content

Commit 1a431d9

Browse files
Mikalai Radchukncdc
authored andcommitted
Tidies up Makefile
* Fixes default target. It looks like target `all` was previously define first to implicitly set `build` to be default target, but since introduction `include` above the `all` target - now `BINGO` is default target. This change explicitly sets `build` to be default. * Sets several targets as phony as they are not targeting a file and moves `.PHONY` closer to target definition for better visibility. * Removes unused `wait` target Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent d0f1b7a commit 1a431d9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ SHELL = /usr/bin/env bash -o pipefail
4141
# Disable -j flag for make
4242
.NOTPARALLEL:
4343

44-
.PHONY: all
45-
all: build
44+
.DEFAULT_GOAL := build
4645

4746
##@ General
4847

@@ -91,19 +90,22 @@ fmt: ## Run go fmt against code.
9190
vet: ## Run go vet against code.
9291
go vet ./...
9392

94-
.PHONY: test test-e2e e2e kind-load kind-cluster kind-cluster-cleanup
93+
.PHONY: test
9594
test: manifests generate fmt vet test-unit e2e ## Run all tests.
9695

96+
.PHONY: test-e2e
9797
FOCUS := $(if $(TEST),-v -focus "$(TEST)")
9898
E2E_FLAGS ?= ""
9999
test-e2e: $(GINKGO) ## Run the e2e tests
100100
$(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/e2e
101101

102+
.PHONY: test-unit
102103
ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
103104
UNIT_TEST_DIRS=$(shell go list ./... | grep -v /test/)
104105
test-unit: $(SETUP_ENVTEST) ## Run the unit tests
105106
eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -count=1 -short $(UNIT_TEST_DIRS) -coverprofile cover.out
106107

108+
.PHONY: e2e
107109
e2e: KIND_CLUSTER_NAME=operator-controller-e2e
108110
e2e: KUSTOMIZE_BUILD_DIR=config/e2e
109111
e2e: GO_BUILD_FLAGS=-cover
@@ -113,13 +115,16 @@ e2e: run kind-load-test-artifacts test-e2e e2e-coverage kind-cluster-cleanup ##
113115
e2e-coverage:
114116
COVERAGE_OUTPUT=./e2e-cover.out ./hack/e2e-coverage.sh
115117

118+
.PHONY: kind-load
116119
kind-load: $(KIND) ## Loads the currently constructed image onto the cluster
117120
$(KIND) load docker-image $(IMG) --name $(KIND_CLUSTER_NAME)
118121

122+
.PHONY: kind-cluster
119123
kind-cluster: $(KIND) ## Standup a kind cluster
120124
$(KIND) create cluster --name ${KIND_CLUSTER_NAME}
121125
$(KIND) export kubeconfig --name ${KIND_CLUSTER_NAME}
122126

127+
.PHONY: kind-cluster-cleanup
123128
kind-cluster-cleanup: $(KIND) ## Delete the kind cluster
124129
$(KIND) delete cluster --name ${KIND_CLUSTER_NAME}
125130

@@ -162,10 +167,6 @@ go-build-linux:
162167
.PHONY: run
163168
run: docker-build kind-cluster kind-load install ## Build the operator-controller then deploy it into a new kind cluster.
164169

165-
.PHONY: wait
166-
wait:
167-
kubectl wait --for=condition=Available --namespace=$(OPERATOR_CONTROLLER_NAMESPACE) deployment/operator-controller-controller-manager --timeout=$(WAIT_TIMEOUT)
168-
169170
.PHONY: docker-build
170171
docker-build: build-linux ## Build docker image for operator-controller with GOOS=linux and local GOARCH.
171172
docker build -t ${IMG} -f Dockerfile ./bin/linux
@@ -178,9 +179,11 @@ docker-build: build-linux ## Build docker image for operator-controller with GOO
178179
export ENABLE_RELEASE_PIPELINE ?= false
179180
export GORELEASER_ARGS ?= --snapshot --clean
180181

182+
.PHONY: release
181183
release: $(GORELEASER) ## Runs goreleaser for the operator-controller. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release.
182184
$(GORELEASER) $(GORELEASER_ARGS)
183185

186+
.PHONY: quickstart
184187
quickstart: export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml"
185188
quickstart: $(KUSTOMIZE) generate ## Generate the installation release manifests and scripts
186189
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml

0 commit comments

Comments
 (0)