Skip to content

Commit

Permalink
Makefile: add clean target (opendatahub-io#733)
Browse files Browse the repository at this point in the history
Add `make clean` which removes build artefacts. At the moment it's
./bin, ./odh-manifests/* and cover.out from test target.

Do not remove odh-manifests directory since it is commited to VCS.

In the recipe chown of $(LOCALBIN) since setup-envtest makes its dir
RO for some reason [1].

Related: opendatahub-io#696

[1] https://github.com/kubernetes-sigs/controller-runtime/blob/main/tools/setup-envtest/store/store.go#L191

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
  • Loading branch information
ykaliuta authored Dec 1, 2023
1 parent d81665d commit 5f4f38b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ lint: golangci-lint ## Run golangci-lint against code.
.PHONY: get-manifests
get-manifests: ## Fetch components manifests from remote git repo
./get_all_manifests.sh
CLEANFILES += odh-manifests/*

##@ Build

Expand Down Expand Up @@ -198,6 +199,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
CLEANFILES += $(LOCALBIN)

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -315,7 +317,12 @@ test: unit-test e2e-test
.PHONY: unit-test
unit-test: envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(TEST_SRC) -v -coverprofile cover.out
CLEANFILES += cover.out

.PHONY: e2e-test
e2e-test: ## Run e2e tests for the controller
go test ./tests/e2e/ -run ^TestOdhOperator -v --operator-namespace=${OPERATOR_NAMESPACE} ${E2E_TEST_FLAGS}

clean:
chmod u+w -R $(LOCALBIN) # envtest makes its dir RO
rm -rf $(CLEANFILES)

0 comments on commit 5f4f38b

Please sign in to comment.