-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
85 lines (63 loc) · 3.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright (c) 2022 Red Hat, Inc.
# Copyright Contributors to the Open Cluster Management project
-include /opt/build-harness/Makefile.prow
REGISTRY ?= quay.io/stolostron
IMAGE_TAG ?= latest
TMP_BIN ?= /tmp/cr-tests-bin
GO_TEST ?= go test -v
GIT_COMMIT := $(shell git rev-parse --short HEAD)
.PHONY: vendor ##download all third party libraries and puts them inside vendor directory
vendor:
@go mod vendor
.PHONY: tidy
tidy:
@go mod tidy
.PHONY: clean-vendor ##removes third party libraries from vendor directory
clean-vendor:
-@rm -rf vendor
build-operator-image: vendor
cd operator && make
docker build -t ${REGISTRY}/multicluster-global-hub-operator:${IMAGE_TAG} . -f operator/Dockerfile --build-arg GIT_COMMIT=$(GIT_COMMIT)
push-operator-image:
docker push ${REGISTRY}/multicluster-global-hub-operator:${IMAGE_TAG}
deploy-operator:
cd operator && make deploy
undeploy-operator:
cd operator && make undeploy
build-manager-image: vendor
cd manager && make
docker build -t ${REGISTRY}/multicluster-global-hub-manager:${IMAGE_TAG} . -f manager/Dockerfile --build-arg GIT_COMMIT=$(GIT_COMMIT)
push-manager-image:
docker push ${REGISTRY}/multicluster-global-hub-manager:${IMAGE_TAG}
build-agent-image: vendor
cd agent && make
docker build -t ${REGISTRY}/multicluster-global-hub-agent:${IMAGE_TAG} . -f agent/Dockerfile --build-arg GIT_COMMIT=$(GIT_COMMIT)
push-agent-image:
docker push ${REGISTRY}/multicluster-global-hub-agent:${IMAGE_TAG}
.PHONY: unit-tests
unit-tests: unit-tests-pkg unit-tests-operator unit-tests-manager unit-tests-agent
setup_envtest:
GOBIN=${TMP_BIN} go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
unit-tests-operator: setup_envtest
KUBEBUILDER_ASSETS="$(shell ${TMP_BIN}/setup-envtest use --use-env -p path)" ${GO_TEST} `go list ./operator/... | grep -v test`
unit-tests-manager: setup_envtest
KUBEBUILDER_ASSETS="$(shell ${TMP_BIN}/setup-envtest use --use-env -p path)" ${GO_TEST} `go list ./manager/... | grep -v test`
unit-tests-agent: setup_envtest
KUBEBUILDER_ASSETS="$(shell ${TMP_BIN}/setup-envtest use --use-env -p path)" ${GO_TEST} `go list ./agent/... | grep -v test`
unit-tests-pkg: setup_envtest
KUBEBUILDER_ASSETS="$(shell ${TMP_BIN}/setup-envtest use --use-env -p path)" ${GO_TEST} `go list ./pkg/... | grep -v test`
.PHONY: fmt ##formats the code
fmt:
@go fmt ./agent/... ./manager/... ./operator/... ./pkg/... ./test/...
git diff --exit-code
! grep -ir "multicluster-global-hub/agent/\|multicluster-global-hub/operator/\|multicluster-global-hub/manager/" ./pkg
! grep -ir "multicluster-global-hub/agent/\|multicluster-global-hub/manager/" ./operator
! grep -ir "multicluster-global-hub/operator/\|multicluster-global-hub/manager/|" ./agent
! grep -ir "multicluster-global-hub/agent/" ./manager
.PHONY: strict-fmt ##formats the code
strict-fmt:
@gci write -s standard -s default -s "prefix(github.com/stolostron/multicluster-global-hub)" ./agent/ ./manager/ ./operator/ ./pkg/ ./test/
gofumpt -w ./agent/ ./manager/ ./operator/ ./pkg/ ./test/
git diff --exit-code
# Include the e2e an integration makefile.
include ./test/Makefile