forked from gardener/dependency-watchdog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (70 loc) · 2.39 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
86
87
88
89
90
# SPDX-FileCopyrightText: 2019 SAP SE or an SAP affiliate company and Gardener contributors.
#
# SPDX-License-Identifier: Apache-2.0
VERSION := $(shell cat VERSION)
REGISTRY := europe-docker.pkg.dev/gardener-project/public/gardener
IMAGE_REPOSITORY := $(REGISTRY)/dependency-watchdog
IMAGE_TAG := $(VERSION)
BIN_DIR := bin
# Tools
TOOLS_DIR := hack/tools
include hack/tools.mk
ENVTEST := $(TOOLS_BIN_DIR)/setup-envtest
.PHONY: revendor
revendor:
@env GO111MODULE=on go mod tidy
@env GO111MODULE=on go mod vendor
.PHONY: update-dependencies
update-dependencies:
@env GO111MODULE=on go get -u
@make revendor
.PHONY: check-vulnerabilities
check-vulnerabilities: $(GO_VULN_CHECK)
$(GO_VULN_CHECK) ./...
.PHONY: build
build:
@.ci/build
.PHONY: build-local
build-local:
@env LOCAL_BUILD=1 .ci/build
.PHONY: docker-image
docker-image:
@docker build -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) -f Dockerfile --rm .
.PHONY: docker-push
docker-push:
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(IMAGE_TAG); then echo "$(IMAGE_REPOSITORY) version $(IMAGE_TAG) is not yet built. Please run 'make docker-image'"; false; fi
@docker push $(IMAGE_REPOSITORY):$(IMAGE_TAG)
.PHONY: clean
clean:
@rm -rf $(BIN_DIR)/
@rm -rf $(TOOLS_BIN_DIR)
.PHONY: check
check: $(GOIMPORTS) $(GOLANGCI_LINT) $(LOGCHECK) $(GO_IMPORT_BOSS)
@./hack/check.sh --golangci-lint-config=./.golangci.yaml ./controllers/... ./internal/...
@./hack/check-imports.sh ./api/... ./cmd/... ./controllers/... ./internal/...
.PHONY: import-boss
import-boss: $(GO_IMPORT_BOSS)
@./hack/check-imports.sh ./cmd/...
.PHONY: format
format:
@./hack/format.sh ./controllers ./internal
.PHONY: test
test: $(SETUP_ENVTEST)
@./hack/test.sh
.PHONY: kind-tests
kind-tests:
@./hack/kind-test.sh
.PHONY: install-envtest
install-envtest: $(SETUP_ENVTEST)
$(shell $(ENVTEST) --os $(go env GOOS) --arch $(go env GOARCH) --use-env use $(ENVTEST_K8S_VERSION) -p path)
.PHONY: verify
verify: check format test
.PHONY: add-license-headers
add-license-headers: $(GO_ADD_LICENSE)
@./hack/addlicenseheaders.sh
# Taken this trick from https://pawamoy.github.io/posts/pass-makefile-args-as-typed-in-command-line/
args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
stress_args = test-package test-func tool-params
.PHONY: stress
stress: $(GO_STRESS)
@./hack/stress-test.sh $@ $(call args,$@)