1
1
# Copyright 2019 The Kubernetes Authors.
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
- .PHONY : generate license fix vet fmt test lint tidy openapi
5
-
6
4
GOPATH := $(shell go env GOPATH)
7
5
MYGOBIN := $(shell go env GOPATH) /bin
8
6
SHELL := /bin/bash
9
7
export PATH := $(MYGOBIN ) :$(PATH )
10
8
9
+ .PHONY : all
11
10
all : generate license fix vet fmt test lint tidy
12
11
12
+ "$(MYGOBIN ) /stringer" :
13
+ go install golang.org/x/tools/cmd/
[email protected]
14
+
15
+ "$(MYGOBIN ) /addlicense" :
16
+ go install github.com/google/
[email protected]
17
+
18
+ "$(MYGOBIN ) /golangci-lint" :
19
+ go install github.com/golangci/golangci-lint/cmd/
[email protected]
20
+
21
+ "$(MYGOBIN ) /deepcopy-gen" :
22
+ go install k8s.io/code-generator/cmd/
[email protected]
23
+
24
+ "$(MYGOBIN ) /ginkgo" :
25
+ go install github.com/onsi/ginkgo/
[email protected]
26
+
27
+ "$(MYGOBIN ) /mdrip" :
28
+ go install github.com/monopole/
[email protected]
29
+
30
+ "$(MYGOBIN ) /kind" :
31
+ go install sigs.k8s.io/
[email protected]
32
+
13
33
# The following target intended for reference by a file in
14
34
# https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/cli-utils
15
35
.PHONY : prow-presubmit-check
@@ -20,9 +40,15 @@ prow-presubmit-check: \
20
40
prow-presubmit-check-e2e : \
21
41
install-column-apt test-e2e verify-kapply-e2e
22
42
43
+ .PHONY : prow-presubmit-check-stress
44
+ prow-presubmit-check-stress : \
45
+ test-stress
46
+
47
+ .PHONY : fix
23
48
fix :
24
49
go fix ./...
25
50
51
+ .PHONY : fmt
26
52
fmt :
27
53
go fmt ./...
28
54
@@ -35,86 +61,77 @@ install-column-apt:
35
61
apt-get update
36
62
apt-get install -y bsdmainutils
37
63
38
- install-stringer :
39
- (which
$( GOPATH) /bin/stringer
|| go install golang.org/x/tools/cmd/
[email protected] )
40
-
41
- install-addlicense :
42
- (which
$( GOPATH) /bin/addlicense
|| go install github.com/google/
[email protected] )
43
-
44
- install-lint :
45
- (which
$( GOPATH) /bin/golangci-lint
|| go install github.com/golangci/golangci-lint/cmd/
[email protected] )
46
-
47
- install-deepcopy-gen :
48
- (which
$( GOPATH) /bin/deepcopy-gen
|| go install k8s.io/code-generator/cmd/
[email protected] )
49
-
50
- generate-deepcopy : install-deepcopy-gen
64
+ .PHONY : generate-deepcopy
65
+ generate-deepcopy : "$(MYGOBIN ) /deepcopy-gen"
51
66
hack/run-in-gopath.sh deepcopy-gen --input-dirs ./pkg/apis/... -O zz_generated.deepcopy --go-header-file ./LICENSE_TEMPLATE_GO
52
67
53
- generate : install-stringer generate-deepcopy
68
+ .PHONY : generate
69
+ generate : "$(MYGOBIN ) /stringer" generate-deepcopy
54
70
go generate ./...
55
71
56
- license : install-addlicense
57
- $(GOPATH ) /bin/addlicense -v -y 2021 -c " The Kubernetes Authors." -f LICENSE_TEMPLATE .
72
+ .PHONY : license
73
+ license : "$(MYGOBIN ) /addlicense"
74
+ " $( MYGOBIN) /addlicense" -v -y 2021 -c " The Kubernetes Authors." -f LICENSE_TEMPLATE .
58
75
59
- verify-license : install-addlicense
60
- $(GOPATH ) /bin/addlicense -check .
76
+ .PHONY : verify-license
77
+ verify-license : "$(MYGOBIN ) /addlicense"
78
+ " $( MYGOBIN) /addlicense" -check .
61
79
80
+ .PHONY : tidy
62
81
tidy :
63
82
go mod tidy
64
83
65
- lint : install-lint
66
- $(GOPATH ) /bin/golangci-lint run ./...
84
+ .PHONY : lint
85
+ lint : "$(MYGOBIN ) /golangci-lint"
86
+ " $( MYGOBIN) /golangci-lint" run ./...
67
87
88
+ .PHONY : test
68
89
test :
69
90
go test -race -cover ./cmd/... ./pkg/...
70
91
71
- test-e2e : $(MYGOBIN ) /ginkgo $(MYGOBIN ) /kind
92
+ .PHONY : test-e2e
93
+ test-e2e : "$(MYGOBIN ) /ginkgo" "$(MYGOBIN ) /kind"
72
94
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
73
- $( GOPATH ) /bin/ ginkgo -v ./test/e2e/... -- -v 3
95
+ " $( MYGOBIN ) / ginkgo" -v ./test/e2e/... -- -v 3
74
96
75
97
.PHONY : test-e2e-focus
76
- test-e2e-focus : $(MYGOBIN ) /ginkgo $(MYGOBIN ) /kind
98
+ test-e2e-focus : " $(MYGOBIN ) /ginkgo" " $(MYGOBIN ) /kind"
77
99
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
78
- $( GOPATH ) /bin /ginkgo -v -focus " .*$( FOCUS) .*" ./test/e2e/... -- -v 5
100
+ " $( MYGOBIN ) " /ginkgo -v -focus " .*$( FOCUS) .*" ./test/e2e/... -- -v 5
79
101
80
- test-stress : $(MYGOBIN ) /ginkgo $(MYGOBIN ) /kind
102
+ .PHONY : test-stress
103
+ test-stress : "$(MYGOBIN ) /ginkgo" "$(MYGOBIN ) /kind"
81
104
kind delete cluster --name=cli-utils-e2e && kind create cluster --name=cli-utils-e2e --wait 5m
82
- $( GOPATH ) /bin/ ginkgo -v ./test/stress/... -- -v 3
105
+ " $( MYGOBIN ) / ginkgo" -v ./test/stress/... -- -v 3
83
106
107
+ .PHONY : vet
84
108
vet :
85
109
go vet ./...
86
110
111
+ .PHONY : build
87
112
build :
88
113
go build -o bin/kapply sigs.k8s.io/cli-utils/cmd;
89
- mv bin/kapply $(MYGOBIN )
114
+ mv bin/kapply " $( MYGOBIN) "
90
115
116
+ .PHONY : build-with-race-detector
91
117
build-with-race-detector :
92
118
go build -race -o bin/kapply sigs.k8s.io/cli-utils/cmd;
93
- mv bin/kapply $(MYGOBIN )
119
+ mv bin/kapply " $( MYGOBIN) "
94
120
95
121
.PHONY : verify-kapply-e2e
96
122
verify-kapply-e2e : test-examples-e2e-kapply
97
123
98
- $(MYGOBIN ) /ginkgo :
99
- go install github.com/onsi/ginkgo/
[email protected]
100
-
101
- $(MYGOBIN ) /mdrip :
102
- go install github.com/monopole/
[email protected]
103
-
104
- .PHONY :
105
- test-examples-e2e-kapply : $(MYGOBIN ) /mdrip $(MYGOBIN ) /kind
124
+ .PHONY : test-examples-e2e-kapply
125
+ test-examples-e2e-kapply : "$(MYGOBIN ) /mdrip" "$(MYGOBIN ) /kind"
106
126
( \
107
127
set -e; \
108
128
/bin/rm -f bin/kapply; \
109
- /bin/rm -f $(MYGOBIN ) /kapply; \
129
+ /bin/rm -f " $( MYGOBIN) /kapply" ; \
110
130
echo " Installing kapply from ." ; \
111
131
make build-with-race-detector; \
112
132
./hack/testExamplesE2EAgainstKapply.sh . ; \
113
133
)
114
134
115
- $(MYGOBIN ) /kind :
116
- go install sigs.k8s.io/
[email protected]
117
-
118
135
.PHONY : nuke
119
- nuke : clean
120
- sudo rm -rf $( shell go env GOPATH) /pkg/mod/sigs.k8s.io
136
+ nuke :
137
+ sudo rm -rf " $( GOPATH) /pkg/mod/sigs.k8s.io"
0 commit comments