@@ -51,11 +51,15 @@ IMAGE_TAGS+=$(shell tagged="$$(git describe --tags --match='v*' --abbrev=0)"; if
51
51
IMAGE_NAME =$(REGISTRY_NAME ) /$*
52
52
53
53
ifdef V
54
+ # Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed.
54
55
TESTARGS = -v -args -alsologtostderr -v 5
55
56
else
56
57
TESTARGS =
57
58
endif
58
59
60
+ # Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
61
+ # to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below.
62
+
59
63
build-% :
60
64
mkdir -p bin
61
65
CGO_ENABLED=0 GOOS=linux go build -a -ldflags ' -X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
@@ -70,7 +74,7 @@ push-%: container-%
70
74
docker push $(IMAGE_NAME ) :$$ tag; \
71
75
}; \
72
76
for tag in $( IMAGE_TAGS) ; do \
73
- if echo $$ tag | grep -q -e ' -canary$$' ; then \
77
+ if [ " $$ tag " = " canary " ] || echo " $$ tag" | grep -q -e ' -canary$$' ; then \
74
78
: " creating or overwriting canary image" ; \
75
79
push_image; \
76
80
elif docker pull $(IMAGE_NAME ) :$$ tag 2>&1 | tee /dev/stderr | grep -q " manifest for $( IMAGE_NAME) :$$ tag not found" ; then \
@@ -93,20 +97,20 @@ test:
93
97
.PHONY : test-go
94
98
test : test-go
95
99
test-go :
96
- @ echo ; echo $@
97
- go test ` go list ./... | grep -v ' vendor' ` $(TESTARGS )
100
+ @ echo ; echo " ### $@ : "
101
+ go test ` go list ./... | grep -v ' vendor' $( TEST_GO_FILTER_CMD ) ` $(TESTARGS )
98
102
99
103
.PHONY : test-vet
100
104
test : test-vet
101
105
test-vet :
102
- @ echo ; echo $@
103
- go vet ` go list ./... | grep -v vendor`
106
+ @ echo ; echo " ### $@ : "
107
+ go vet ` go list ./... | grep -v vendor $( TEST_VET_FILTER_CMD ) `
104
108
105
109
.PHONY : test-fmt
106
110
test : test-fmt
107
111
test-fmt :
108
- @ echo ; echo $@
109
- files=$$(find . -name '*.go' | grep -v './vendor' ) ; \
112
+ @ echo ; echo " ### $@ : "
113
+ files=$$(find . -name '*.go' | grep -v './vendor' $( TEST_FMT_FILTER_CMD ) ) ; \
110
114
if [ $$ (gofmt -d $$ files | wc -l) -ne 0 ]; then \
111
115
echo " formatting errors:" ; \
112
116
gofmt -d $$ files; \
@@ -116,5 +120,5 @@ test-fmt:
116
120
.PHONY : test-subtree
117
121
test : test-subtree
118
122
test-subtree :
119
- @ echo ; echo $@
123
+ @ echo ; echo " ### $@ : "
120
124
./release-tools/verify-subtree.sh release-tools
0 commit comments