Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release tools update #36

Merged
merged 31 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f1697d2
Do full git clones in travis. Shallow clones are causing test-subtree
msau42 Oct 8, 2019
adf00fe
Merge pull request #36 from msau42/full-clone
k8s-ci-robot Oct 8, 2019
e0fde8c
Add new variables for 1.16 and remove 1.13
msau42 Oct 31, 2019
f419d74
Merge pull request #40 from msau42/add-1.16
k8s-ci-robot Oct 31, 2019
5e773d2
update CI to use Go 1.13.3
pohly Oct 31, 2019
c8a1c4a
better handling of Go version
pohly Oct 31, 2019
a53bd4c
Merge pull request #41 from pohly/go-version
k8s-ci-robot Oct 31, 2019
23df4ae
prow.sh: use vendor directory if available
pohly Nov 4, 2019
8067845
travis.yml: also use vendor directory
pohly Nov 4, 2019
ee22a9c
Merge pull request #42 from pohly/use-vendor-dir
k8s-ci-robot Nov 4, 2019
f41c135
prow.sh: also log output of system containers
pohly Nov 5, 2019
4fcafec
Merge pull request #43 from pohly/system-pod-logging
k8s-ci-robot Nov 6, 2019
83a4ef1
Adding build for ppc64le
Pensu Nov 19, 2019
1eaaaa1
Delete kind cluster after tests run.
mucahitkurt Nov 16, 2019
a41f386
Merge pull request #46 from mucahitkurt/kind-cluster-cleanup
k8s-ci-robot Nov 21, 2019
003c14b
Add snapshotter CRDs after cluster setup
ggriffiths Nov 12, 2019
8adde49
Merge pull request #45 from ggriffiths/snapshot_beta_crds
k8s-ci-robot Nov 25, 2019
6d674a7
Merge pull request #47 from Pensu/multi-arch
k8s-ci-robot Nov 26, 2019
80bba1f
Use kind v0.6.0
darkowlzz Nov 29, 2019
4ff2f5f
Merge pull request #50 from darkowlzz/kind-0.6.0
k8s-ci-robot Dec 2, 2019
9a7a685
Create a kind cluster with two worker nodes so that the topology feat…
msau42 Dec 3, 2019
53888ae
Improve README by adding an explicit Kubernetes dependency section
msau42 Dec 4, 2019
4ad6949
Improve snapshot pod running checks and improve version_gt
ggriffiths Dec 4, 2019
d7c69d2
Merge pull request #51 from msau42/enable-multinode
k8s-ci-robot Dec 4, 2019
771ca6f
Merge pull request #49 from ggriffiths/prowsh_improve_version_gt
k8s-ci-robot Dec 4, 2019
a4e6299
fix syntax for ppc64le build
msau42 Dec 4, 2019
540599b
Merge pull request #53 from msau42/fix-make
k8s-ci-robot Dec 4, 2019
9ace020
Merge pull request #52 from msau42/update-readme
k8s-ci-robot Dec 6, 2019
b98b2ae
Enable snapshot tests in 1.17 to be run in non-alpha jobs.
msau42 Dec 17, 2019
9f1f3dd
Merge pull request #56 from msau42/enable-snapshots
k8s-ci-robot Dec 18, 2019
2e964b6
release-tools: merge commit '9f1f3dd84257356f090ea7ce991dbf467784586e'
pohly Dec 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions release-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,6 @@ The `vendor` directory is optional. It is still present in projects
because it avoids downloading sources during CI builds. If this is no
longer deemed necessary, then a project can also remove the directory.

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

Conversion of a repository that uses `dep` to `go mod` can be done with:

GO111MODULE=on go mod init
Expand All @@ -160,3 +149,18 @@ Conversion of a repository that uses `dep` to `go mod` can be done with:
GO111MODULE=on go mod vendor
git rm -f Gopkg.toml Gopkg.lock
git add go.mod go.sum vendor

### Updating Kubernetes dependencies

When using packages that are part of the Kubernetes source code, the
commands above are not enough because the [lack of semantic
versioning](https://github.com/kubernetes/kubernetes/issues/72638)
prevents `go mod` from finding newer releases. Importing directly from
`kubernetes/kubernetes` also needs `replace` statements to override
the fake `v0.0.0` versions
(https://github.com/kubernetes/kubernetes/issues/79384). The
`go-get-kubernetes.sh` script can be used to update all packages in
lockstep to a different Kubernetes version. Example usage:
```
$ ./release-tools/go-get-kubernetes.sh 1.16.4
```
62 changes: 19 additions & 43 deletions release-tools/build.make
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
# including build.make.
REGISTRY_NAME=quay.io/k8scsi

# Can be set to -mod=vendor to ensure that the "vendor" directory is used.
GOFLAGS_VENDOR=

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

build-%:
build-%: check-go-version-go
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
CGO_ENABLED=0 GOOS=linux go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*
if [ "$$ARCH" = "amd64" ]; then \
CGO_ENABLED=0 GOOS=windows go build -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*.exe ./cmd/$* ; \
CGO_ENABLED=0 GOOS=windows go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*.exe ./cmd/$* ; \
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$*-ppc64le ./cmd/$* ; \
fi

container-%: build-%
Expand Down Expand Up @@ -97,19 +101,19 @@ push: $(CMDS:%=push-%)
clean:
-rm -rf bin

test:
test: check-go-version-go

.PHONY: test-go
test: test-go
test-go:
@ echo; echo "### $@:"
go test `go list ./... | grep -v -e 'vendor' -e '/test/e2e$$' $(TEST_GO_FILTER_CMD)` $(TESTARGS)
go test $(GOFLAGS_VENDOR) `go list $(GOFLAGS_VENDOR) ./... | grep -v -e 'vendor' -e '/test/e2e$$' $(TEST_GO_FILTER_CMD)` $(TESTARGS)

.PHONY: test-vet
test: test-vet
test-vet:
@ echo; echo "### $@:"
go vet `go list ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`
go test $(GOFLAGS_VENDOR) `go list $(GOFLAGS_VENDOR) ./... | grep -v vendor $(TEST_VET_FILTER_CMD)`

.PHONY: test-fmt
test: test-fmt
Expand Down Expand Up @@ -154,43 +158,7 @@ test-fmt:
test: test-vendor
test-vendor:
@ echo; echo "### $@:"
@ if [ -f Gopkg.toml ]; then \
echo "Repo uses 'dep' for vendoring."; \
case "$$(dep version 2>/dev/null | grep 'version *:')" in \
*v0.[56789]*) dep check && echo "vendor up-to-date" || false;; \
*) echo "skipping check, dep >= 0.5 required";; \
esac; \
elif [ -f go.mod ]; then \
echo "Repo uses 'go mod'."; \
if [ "$${JOB_NAME}" ] && \
( [ "$${JOB_TYPE}" != "presubmit" ] || \
[ $$( (git diff "${PULL_BASE_SHA}..HEAD" -- go.mod go.sum vendor release-tools; \
git diff "${PULL_BASE_SHA}..HEAD" | grep -e '^@@.*@@ import (' -e '^[+-]import') | \
wc -l) -eq 0 ] ); then \
echo "Skipping vendor check because the Prow pre-submit job does not affect dependencies."; \
elif ! GO111MODULE=on go mod tidy; then \
echo "ERROR: vendor check failed."; \
false; \
elif [ $$(git status --porcelain -- go.mod go.sum | wc -l) -gt 0 ]; then \
echo "ERROR: go module files *not* up-to-date, they did get modified by 'GO111MODULE=on go mod tidy':"; \
git diff -- go.mod go.sum; \
false; \
elif [ -d vendor ]; then \
if ! GO111MODULE=on go mod vendor; then \
echo "ERROR: vendor check failed."; \
false; \
elif [ $$(git status --porcelain -- vendor | wc -l) -gt 0 ]; then \
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"; \
git status -- vendor; \
git diff -- vendor; \
false; \
else \
echo "Go dependencies and vendor directory up-to-date."; \
fi; \
else \
echo "Go dependencies up-to-date."; \
fi; \
fi
@ ./release-tools/verify-vendor.sh

.PHONY: test-subtree
test: test-subtree
Expand All @@ -216,3 +184,11 @@ test-shellcheck:
./release-tools/verify-shellcheck.sh "$$dir" || ret=1; \
done; \
exit $$ret

# Targets in the makefile can depend on check-go-version-<path to go binary>
# to trigger a warning if the x.y version of that binary does not match
# what the project uses. Make ensures that this is only checked once per
# invocation.
.PHONY: check-go-version-%
check-go-version-%:
./release-tools/verify-go-version.sh "$*"
Loading