Skip to content

Commit 2e964b6

Browse files
committed
release-tools: merge commit '9f1f3dd84257356f090ea7ce991dbf467784586e'
Because the version of Go changes to 1.13.3 and that version vendors differently, the "vendor" directory has to be refreshed. b98b2ae Enable snapshot tests in 1.17 to be run in non-alpha jobs. a4e6299 fix syntax for ppc64le build 4ad6949 Improve snapshot pod running checks and improve version_gt 53888ae Improve README by adding an explicit Kubernetes dependency section 9a7a685 Create a kind cluster with two worker nodes so that the topology feature can be tested. Test cases that test accessing volumes from multiple nodes need to be skipped 80bba1f Use kind v0.6.0 003c14b Add snapshotter CRDs after cluster setup 1eaaaa1 Delete kind cluster after tests run. 83a4ef1 Adding build for ppc64le f41c135 prow.sh: also log output of system containers 8067845 travis.yml: also use vendor directory 23df4ae prow.sh: use vendor directory if available c8a1c4a better handling of Go version 5e773d2 update CI to use Go 1.13.3 e0fde8c Add new variables for 1.16 and remove 1.13 f1697d2 Do full git clones in travis. Shallow clones are causing test-subtree errors when the depth is exactly 50.
2 parents 3db8116 + 9f1f3dd commit 2e964b6

27 files changed

+395
-5574
lines changed

release-tools/README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,6 @@ The `vendor` directory is optional. It is still present in projects
141141
because it avoids downloading sources during CI builds. If this is no
142142
longer deemed necessary, then a project can also remove the directory.
143143

144-
When using packages that are part of the Kubernetes source code, the
145-
commands above are not enough because the [lack of semantic
146-
versioning](https://github.com/kubernetes/kubernetes/issues/72638)
147-
prevents `go mod` from finding newer releases. Importing directly from
148-
`kubernetes/kubernetes` also needs `replace` statements to override
149-
the fake `v0.0.0` versions
150-
(https://github.com/kubernetes/kubernetes/issues/79384). The
151-
`go-get-kubernetes.sh` script can be used to update all packages in
152-
lockstep to a different Kubernetes version. It takes a single version
153-
number like "1.16.0".
154-
155144
Conversion of a repository that uses `dep` to `go mod` can be done with:
156145

157146
GO111MODULE=on go mod init
@@ -160,3 +149,18 @@ Conversion of a repository that uses `dep` to `go mod` can be done with:
160149
GO111MODULE=on go mod vendor
161150
git rm -f Gopkg.toml Gopkg.lock
162151
git add go.mod go.sum vendor
152+
153+
### Updating Kubernetes dependencies
154+
155+
When using packages that are part of the Kubernetes source code, the
156+
commands above are not enough because the [lack of semantic
157+
versioning](https://github.com/kubernetes/kubernetes/issues/72638)
158+
prevents `go mod` from finding newer releases. Importing directly from
159+
`kubernetes/kubernetes` also needs `replace` statements to override
160+
the fake `v0.0.0` versions
161+
(https://github.com/kubernetes/kubernetes/issues/79384). The
162+
`go-get-kubernetes.sh` script can be used to update all packages in
163+
lockstep to a different Kubernetes version. Example usage:
164+
```
165+
$ ./release-tools/go-get-kubernetes.sh 1.16.4
166+
```

release-tools/build.make

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
# including build.make.
2323
REGISTRY_NAME=quay.io/k8scsi
2424

25+
# Can be set to -mod=vendor to ensure that the "vendor" directory is used.
26+
GOFLAGS_VENDOR=
27+
2528
# Revision that gets built into each binary via the main.version
2629
# string. Uses the `git describe` output based on the most recent
2730
# version tag with a short revision suffix or, if nothing has been
@@ -62,11 +65,12 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
6265
# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
6366
# to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below.
6467

65-
build-%:
68+
build-%: check-go-version-go
6669
mkdir -p bin
67-
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
70+
CGO_ENABLED=0 GOOS=linux go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
6871
if [ "$$ARCH" = "amd64" ]; then \
69-
CGO_ENABLED=0 GOOS=windows go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*.exe ./cmd/$* ; \
72+
CGO_ENABLED=0 GOOS=windows go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*.exe ./cmd/$* ; \
73+
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*-ppc64le ./cmd/$* ; \
7074
fi
7175

7276
container-%: build-%
@@ -97,19 +101,19 @@ push: $(CMDS:%=push-%)
97101
clean:
98102
-rm -rf bin
99103

100-
test:
104+
test: check-go-version-go
101105

102106
.PHONY: test-go
103107
test: test-go
104108
test-go:
105109
@ echo; echo "### $@:"
106-
go test `go list ./... | grep -v -e 'vendor' -e '/test/e2e$$' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
110+
go test $(GOFLAGS_VENDOR) `go list $(GOFLAGS_VENDOR) ./... | grep -v -e 'vendor' -e '/test/e2e$$' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
107111

108112
.PHONY: test-vet
109113
test: test-vet
110114
test-vet:
111115
@ echo; echo "### $@:"
112-
go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
116+
go test $(GOFLAGS_VENDOR) `go list $(GOFLAGS_VENDOR) ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
113117

114118
.PHONY: test-fmt
115119
test: test-fmt
@@ -154,43 +158,7 @@ test-fmt:
154158
test: test-vendor
155159
test-vendor:
156160
@ echo; echo "### $@:"
157-
@ if [ -f Gopkg.toml ]; then \
158-
echo "Repo uses 'dep' for vendoring."; \
159-
case "$$(dep version 2>/dev/null | grep 'version *:')" in \
160-
*v0.[56789]*) dep check && echo "vendor up-to-date" || false;; \
161-
*) echo "skipping check, dep >= 0.5 required";; \
162-
esac; \
163-
elif [ -f go.mod ]; then \
164-
echo "Repo uses 'go mod'."; \
165-
if [ "$${JOB_NAME}" ] && \
166-
( [ "$${JOB_TYPE}" != "presubmit" ] || \
167-
[ $$( (git diff "${PULL_BASE_SHA}..HEAD" -- go.mod go.sum vendor release-tools; \
168-
git diff "${PULL_BASE_SHA}..HEAD" | grep -e '^@@.*@@ import (' -e '^[+-]import') | \
169-
wc -l) -eq 0 ] ); then \
170-
echo "Skipping vendor check because the Prow pre-submit job does not affect dependencies."; \
171-
elif ! GO111MODULE=on go mod tidy; then \
172-
echo "ERROR: vendor check failed."; \
173-
false; \
174-
elif [ $$(git status --porcelain -- go.mod go.sum | wc -l) -gt 0 ]; then \
175-
echo "ERROR: go module files *not* up-to-date, they did get modified by 'GO111MODULE=on go mod tidy':"; \
176-
git diff -- go.mod go.sum; \
177-
false; \
178-
elif [ -d vendor ]; then \
179-
if ! GO111MODULE=on go mod vendor; then \
180-
echo "ERROR: vendor check failed."; \
181-
false; \
182-
elif [ $$(git status --porcelain -- vendor | wc -l) -gt 0 ]; then \
183-
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"; \
184-
git status -- vendor; \
185-
git diff -- vendor; \
186-
false; \
187-
else \
188-
echo "Go dependencies and vendor directory up-to-date."; \
189-
fi; \
190-
else \
191-
echo "Go dependencies up-to-date."; \
192-
fi; \
193-
fi
161+
@ ./release-tools/verify-vendor.sh
194162

195163
.PHONY: test-subtree
196164
test: test-subtree
@@ -216,3 +184,11 @@ test-shellcheck:
216184
./release-tools/verify-shellcheck.sh "$$dir" || ret=1; \
217185
done; \
218186
exit $$ret
187+
188+
# Targets in the makefile can depend on check-go-version-<path to go binary>
189+
# to trigger a warning if the x.y version of that binary does not match
190+
# what the project uses. Make ensures that this is only checked once per
191+
# invocation.
192+
.PHONY: check-go-version-%
193+
check-go-version-%:
194+
./release-tools/verify-go-version.sh "$*"

0 commit comments

Comments
 (0)