forked from openshift/machine-api-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
115 lines (90 loc) · 3.09 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
DBG ?= 0
#REGISTRY ?= quay.io/openshift/
VERSION ?= $(shell git describe --always --abbrev=7)
MUTABLE_TAG ?= latest
IMAGE = $(REGISTRY)machine-api-operator
ifeq ($(DBG),1)
GOGCFLAGS ?= -gcflags=all="-N -l"
endif
.PHONY: all
all: check build test
NO_DOCKER ?= 0
ifeq ($(NO_DOCKER), 1)
DOCKER_CMD =
IMAGE_BUILD_CMD = imagebuilder
else
DOCKER_CMD := docker run --rm -v "$(PWD)":/go/src/github.com/openshift/machine-api-operator:Z -w /go/src/github.com/openshift/machine-api-operator golang:1.12
IMAGE_BUILD_CMD = docker build
endif
.PHONY: check
check: lint fmt vet verify-codegen check-pkg test ## Run code validations
.PHONY: check-pkg
check-pkg:
./hack/verify-actuator-pkg.sh
.PHONY: build
build: machine-api-operator nodelink-controller machine-healthcheck ## Build binaries
.PHONY: machine-api-operator
machine-api-operator:
$(DOCKER_CMD) ./hack/go-build.sh machine-api-operator
.PHONY: nodelink-controller
nodelink-controller:
$(DOCKER_CMD) ./hack/go-build.sh nodelink-controller
.PHONY: machine-healthcheck
machine-healthcheck:
$(DOCKER_CMD) ./hack/go-build.sh machine-healthcheck
.PHONY: generate
generate: gen-crd update-codegen
.PHONY: gen-crd
gen-crd:
$(DOCKER_CMD) ./hack/gen-crd.sh
.PHONY: update-codegen
update-codegen:
$(DOCKER_CMD) ./hack/update-codegen.sh
.PHONY: verify-codegen
verify-codegen:
$(DOCKER_CMD) ./hack/verify-codegen.sh
.PHONY: build-integration
build-integration: ## Build integration test binary
@echo -e "\033[32mBuilding integration test binary...\033[0m"
mkdir -p bin
$(DOCKER_CMD) go build $(GOGCFLAGS) -o bin/integration github.com/openshift/machine-api-operator/test/integration
.PHONY: test-e2e
test-e2e: ## Run openshift specific e2e tests
./hack/e2e.sh test-e2e
.PHONY: test-e2e-tech-preview
test-e2e-tech-preview: ## Run openshift specific e2e tech preview tests
./hack/e2e.sh test-e2e-tech-preview
.PHONY: test-sec
test-sec:
@which gosec 2> /dev/null >&1 || { echo "gosec must be installed to lint code"; exit 1; }
gosec -severity medium --confidence medium -quiet ./...
.PHONY: deploy-kubemark
deploy-kubemark:
kustomize build config | kubectl apply -f -
kustomize build | kubectl apply -f -
kubectl apply -f config/kubemark-config-infra.yaml
.PHONY: test
test: ## Run tests
@echo -e "\033[32mTesting...\033[0m"
$(DOCKER_CMD) go test ./...
.PHONY: image
image: ## Build docker image
@echo -e "\033[32mBuilding image $(IMAGE):$(VERSION) and tagging also as $(IMAGE):$(MUTABLE_TAG)...\033[0m"
$(IMAGE_BUILD_CMD) -t "$(IMAGE):$(VERSION)" -t "$(IMAGE):$(MUTABLE_TAG)" ./
.PHONY: push
push: ## Push image to docker registry
@echo -e "\033[32mPushing images...\033[0m"
docker push "$(IMAGE):$(VERSION)"
docker push "$(IMAGE):$(MUTABLE_TAG)"
.PHONY: lint
lint: ## Go lint your code
hack/go-lint.sh -min_confidence 0.3 $(go list -f '{{ .ImportPath }}' ./...)
.PHONY: fmt
fmt: ## Go fmt your code
hack/go-fmt.sh .
.PHONY: vet
vet: ## Apply go vet to all go files
hack/go-vet.sh ./...
.PHONY: help
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'