4aff857d Merge pull request #109 from pohly/alpha-test-defaults 0427289d Merge pull request #110 from pohly/kind-0.9-bazel-build-workaround 9a370ab9 prow.sh: work around "kind build node-image" failure 522361ec prow.sh: only run alpha tests for latest Kubernetes release 22c0395c Merge pull request #108 from bnrjee/master b5b447b5 Add go ldflags using LDFLAGS at the time of compilation 16f4afbd Merge pull request #107 from pohly/kind-update 7bcee13d prow.sh: update to kind 0.9, support Kubernetes 1.19 df518fbd prow.sh: usage of Bazel optional c3afd427 Merge pull request #104 from xing-yang/snapshot dde93b22 Update to snapshot-controller v3.0.0a0f195ccMerge pull request #106 from msau42/fix-canary7100c120Only set staging registry when running canary jobb3c65f9cMerge pull request #99 from msau42/add-release-processe53f3e85Merge pull request #103 from msau42/fix-canaryd1294628Document new method for adding CI jobs are new K8s versionse73c2ce5Use staging registry for canary tests2c098465Add cleanup instructions to release-notes generation60e1cd3dMerge pull request #98 from pohly/kubernetes-1-19-fixes0979c091prow.sh: fix E2E suite for Kubernetes >= 1.183b4a2f1dprow.sh: fix installing Go for Kubernetes 1.19.01fbb636cMerge pull request #97 from pohly/go-1.1582d108acswitch to Go 1.15d8a25300Merge pull request #95 from msau42/add-release-process843bddcaAdd steps on promoting release images0345a835Merge pull request #94 from linux-on-ibm-z/bump-timeout1fdf2d53cloud build: bump timeout in Prow job41ec6d15Merge pull request #93 from animeshk08/patch-15a54e67dfilter-junit: Fix gofmt error0676fcbdMerge pull request #92 from animeshk08/patch-136ea4ffafilter-junit: Fix golint errorf5a42037Merge pull request #91 from cyb70289/arm6443e50d6fprow.sh: enable building arm64 image0d5bd843Merge pull request #90 from pohly/k8s-staging-sig-storage3df86b7dcloud build: k8s-staging-sig-storagec5fd9610Merge pull request #89 from pohly/cloud-build-binfmtdb0c2a7dcloud build: initialize support for running commands in Dockerfilebe902f40Merge pull request #88 from pohly/multiarch-windows-fix340e082fbuild.make: optional inclusion of Windows in multiarch images5231f05dbuild.make: properly declare push-multiarch4569f27abuild.make: fix push-multiarch ambiguity17dde9efMerge pull request #87 from pohly/cloud-buildbd416901cloud build: initial set of shared files9084fecbMerge pull request #81 from msau42/add-release-process6f2322e8Update patch release notes generation command0fcc3b1bMerge pull request #78 from ggriffiths/fix_csi_snapshotter_rbac_version_setd8c76feeSupport local snapshot RBAC for pull jobsc1bdf5bfMerge pull request #80 from msau42/add-release-processea1f94aaupdate release tools instructions152396e2Merge pull request #77 from ggriffiths/snapshotter201_update7edc1461Update snapshotter to version 2.0.14cf843f6Merge pull request #76 from pohly/build-targets3863a0f6build for multiple platforms only in CI, add s390x8322a7d0Merge pull request #72 from pohly/hostpath-update7c5a89c8prow.sh: use 1.3.0 hostpath driver for testingb8587b2bMerge pull request #71 from wozniakjan/test-vetfdb32183Change 'make test-vet' to call 'go vet'd717c8c4Merge pull request #69 from pohly/test-driver-configa1432bc9Merge pull request #70 from pohly/kubelet-feature-gates5f74333aprow.sh: also configure feature gates for kubelet84f78b12prow.sh: generic driver installation3c34b4f2Merge pull request #67 from windayski/fix-linkfa90abd0fix incorrect linkff3cc3f1Merge pull request #54 from msau42/add-release-processac8a0212Document the process for releasing a new sidecar23be6525Merge pull request #65 from msau42/update-hostpath6582f2ffUpdate hostpath driver version to get fix for connection-timeout4cc91745Merge pull request #64 from ggriffiths/snapshotter_2_version_update8191eab6Update snapshotter to version v2.0.03c463fb1Merge pull request #61 from msau42/enable-snapshots8b0316c7Fix overriding of junit results by using unique names for each e2e run5f444b80Merge pull request #60 from saad-ali/updateHostpathVersionaf9549b5Update prow hostpath driver version to 1.3.0-rc2f6c74b30Merge pull request #57 from ggriffiths/version_gt_kubernetes_fixfc809759Fix version_gt to work with kubernetes prefix9f1f3dd8Merge pull request #56 from msau42/enable-snapshotsb98b2aedEnable snapshot tests in 1.17 to be run in non-alpha jobs.9ace0204Merge pull request #52 from msau42/update-readme540599baMerge pull request #53 from msau42/fix-makea4e62996fix syntax for ppc64le build771ca6f2Merge pull request #49 from ggriffiths/prowsh_improve_version_gtd7c69d2fMerge pull request #51 from msau42/enable-multinode4ad69492Improve snapshot pod running checks and improve version_gt53888ae7Improve README by adding an explicit Kubernetes dependency section9a7a685eCreate 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 skipped4ff2f5f0Merge pull request #50 from darkowlzz/kind-0.6.080bba1feUse kind v0.6.06d674a7fMerge pull request #47 from Pensu/multi-arch8adde494Merge pull request #45 from ggriffiths/snapshot_beta_crds003c14b2Add snapshotter CRDs after cluster setupa41f3860Merge pull request #46 from mucahitkurt/kind-cluster-cleanup1eaaaa1cDelete kind cluster after tests run.83a4ef15Adding build for ppc64le4fcafeceMerge pull request #43 from pohly/system-pod-loggingf41c1351prow.sh: also log output of system containersee22a9caMerge pull request #42 from pohly/use-vendor-dir80678456travis.yml: also use vendor directory23df4aefprow.sh: use vendor directory if availablea53bd4c4Merge pull request #41 from pohly/go-versionc8a1c4afbetter handling of Go version5e773d2dupdate CI to use Go 1.13.3f419d745Merge pull request #40 from msau42/add-1.16e0fde8c4Add new variables for 1.16 and remove 1.13adf00feaMerge pull request #36 from msau42/full-clonef1697d2cDo full git clones in travis. Shallow clones are causing test-subtree errors when the depth is exactly 50.2c819198Merge pull request #34 from pohly/go-mod-tidy518d6af6Merge pull request #35 from ddebroy/winbld22d6b3ce8Build Windows only for amd64c1078a65go-get-kubernetes.sh: automate Kubernetes dependency handling194289aaupdate Go mod support0affdf95Merge pull request #33 from gnufied/enable-hostpath-expansion6208f6abEnable hostpath expansion6ecaa76eMerge pull request #30 from msau42/fix-windowsea2f1b52build windows binaries with .exe suffix2d335506Merge pull request #29 from mucahitkurt/create-2-node-kind-clustera8ea8bcccreate 2-node kind cluster since topology support is added to hostpath driverdf8530d9Merge pull request #27 from pohly/dep-vendor-check35ceaedcprow.sh: install dep if neededf85ab5afMerge pull request #26 from ddebroy/windows19fba09b4Add rule for building Windows binaries04008676Merge pull request #25 from msau42/fix-master-jobsdc0a5d83Update kind to v0.5.0aa85b82cMerge pull request #23 from msau42/fix-master-jobsf46191d9Kubernetes master changed the way that releases are tagged, which needed changes to kind. There are 3 changes made to prow.sh:1cac3af3Merge pull request #22 from msau42/add-1.15-jobs0c0dc300prow.sh: tag master images with a large version numberf4f73cefMerge pull request #21 from msau42/add-1.15-jobs4e31f078Change default hostpath driver name to hostpath.csi.k8s.io4b6fa4a0Update hostpath version for sidecar testing to v1.2.0-rc2ecc79187Update kind to v0.4.0. This requires overriding Kubernetes versions with specific patch versions that kind 0.4.0 supports. Also, feature gate setting is only supported on 1.15+ due to kind.sigs.k8s.io/v1alpha3 and kubeadm.k8s.io/v1beta2 dependencies.a6f21d40Add variables for 1.15db8abb6eMerge pull request #20 from pohly/test-driver-configb2f4e051prow.sh: flexible test driver config03999882Merge pull request #19 from pohly/go-mod-vendor066143d1build.make: allow repos to use 'go mod' for vendoring0bee7493Merge pull request #18 from pohly/go-versione157b6b5update to Go 1.12.488dc9a47Merge pull request #17 from pohly/prow0fafc663prow.sh: skip sanity testing if component doesn't support itbcac1c1fMerge pull request #16 from pohly/prow0b10f6a4prow.sh: update csi-driver-host-path0c2677e8Merge pull request #15 from pengzhisun/masterff9bce4aReplace 'return' to 'exit' to fix shellcheck errorc60f3823Merge pull request #14 from pohly/prow7aaac225prow.sh: remove AllAlpha=all, part II66177736Merge pull request #13 from pohly/prowcda2fc58prow.sh: avoid AllAlpha=true546d5504prow.sh: debug failing KinD cluster creation9b0d9cd7build.make: skip shellcheck if Docker is not availableaa45a1cdprow.sh: more efficient execution of individual testsf3d1d2dfprow.sh: fix hostpath driver version check31dfaf31prow.sh: fix running of just "alpha" testsf5014439prow.sh: AllAlpha=true for unknown Kubernetes versions95ae9de9Merge pull request #9 from pohly/prowd87eccb4prow.sh: switch back to upstream csi-driver-host-path6602d38bprow.sh: different E2E suite depending on Kubernetes version741319bdprow.sh: improve building Kubernetes from source29545bb0prow.sh: take Go version from Kubernetes source429581c5prow.sh: pull Go version from travis.yml0a0fd49bprow.sh: comment clarification2069a0afMerge pull request #11 from pohly/verify-shellcheck55212ff2initial Prow test job6c7ba1bebuild.make: integrate shellcheck into "make test"b2d25d4fverify-shellcheck.sh: make it usable in csi-release-tools3b6af7b1Merge pull request #12 from pohly/local-e2e-suite104a1ac9build.make: avoid unit-testing E2E test suite34010e75Merge pull request #10 from pohly/vendor-checke6db50dfcheck vendor directoryfb13c519verify-shellcheck.sh: import from Kubernetes94fc1e31build.make: avoid unit-testing E2E test suite849db0adMerge pull request #8 from pohly/subtree-check-relaxcc564f92verify-subtree.sh: relax check and ignore old content33d58fdcMerge pull request #5 from pohly/test-enhancementsbe8a4400Merge pull request #4 from pohly/canary-fixb0336b55build.make: more readable "make test" output09436b9fbuild.make: fix pushing of "canary" image from master branch147892c9build.make: support suppressing checks154e33d4build.make: clarify usage of "make V=1" git-subtree-dir: release-tools git-subtree-split: 4aff857d88149e07951fcd1322f462f765401a86
csi-release-tools
These build and test rules can be shared between different Go projects without modifications. Customization for the different projects happen in the top-level Makefile.
The rules include support for building and pushing Docker images, with the following features:
- one or more command and image per project
- push canary and/or tagged release images
- automatically derive the image tag(s) from repo tags
- the source code revision is stored in a "revision" image label
- never overwrites an existing release image
Usage
The expected repository layout is:
cmd/*/*.go- source code for each commandcmd/*/Dockerfile- docker file for each command or Dockerfile in the root when only building a single commandMakefile- includesrelease-tools/build.makeand sets configuration variables.travis.yml- a symlink torelease-tools/.travis.yml
To create a release, tag a certain revision with a name that
starts with v, for example v1.0.0, then make push
while that commit is checked out.
It does not matter on which branch that revision exists, i.e. it is possible to create releases directly from master. A release branch can still be created for maintenance releases later if needed.
Release branches are expected to be named release-x.y for releases
x.y.z. Building from such a branch creates x.y-canary
images. Building from master creates the main canary image.
Sharing and updating
git subtree
is the recommended way of maintaining a copy of the rules inside the
release-tools directory of a project. This way, it is possible to make
changes also locally, test them and then push them back to the shared
repository at a later time.
Cheat sheet:
git subtree add --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master- add release tools to a repo which does not have them yet (only once)git subtree pull --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master- update local copy to latest upstream (whenever upstream changes)- edit,
git commit,git subtree push --prefix=release-tools git@github.com:<user>/csi-release-tools.git <my-new-or-existing-branch>- push to a new branch before submitting a PR
verify-shellcheck.sh
The verify-shellcheck.sh script in this repo
is a stripped down copy of the corresponding
script
in the Kubernetes repository. It can be used to check for certain
errors shell scripts, like missing quotation marks. The default
test-shellcheck target in build.make only checks the
scripts in this directory. Components can add more directories to
TEST_SHELLCHECK_DIRS to check also other scripts.
End-to-end testing
A repo that wants to opt into testing via Prow must set up a top-level
.prow.sh. Typically that will source prow.sh and then transfer
control to it:
#! /bin/bash -e
. release-tools/prow.sh
main
All Kubernetes-CSI repos are expected to switch to Prow. For details on what is enabled in Prow, see https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-csi
Test results for periodic jobs are visible in https://testgrid.k8s.io/sig-storage-csi-ci
It is possible to reproduce the Prow testing locally on a suitable machine:
- Linux host
- Docker installed
- code to be tested checkout out in
$GOPATH/src/<import path> cd $GOPATH/src/<import path> && ./.prow.sh
Beware that the script intentionally doesn't clean up after itself and
modifies the content of $GOPATH, in particular the kubernetes and
kind repositories there. Better run it in an empty, disposable
$GOPATH.
When it terminates, the following command can be used to get access to the Kubernetes cluster that was brought up for testing (assuming that this step succeeded):
export KUBECONFIG="$(kind get kubeconfig-path --name="csi-prow")"
It is possible to control the execution via environment variables. See
prow.sh for details. Particularly useful is testing against different
Kubernetes releases:
CSI_PROW_KUBERNETES_VERSION=1.13.3 ./.prow.sh
CSI_PROW_KUBERNETES_VERSION=latest ./.prow.sh
Dependencies and vendoring
Most projects will (eventually) use go mod to manage
dependencies. dep is also still supported by csi-release-tools,
but not documented here because it's not recommended anymore.
The usual instructions for using go modules apply. Here's a cheat sheet for some of the relevant commands:
- list available updates:
GO111MODULE=on go list -u -m all - update or add a single dependency:
GO111MODULE=on go get <package> - update all dependencies to their next minor or patch release:
GO111MODULE=on go get ./...(add-u=patchto limit to patch releases) - lock onto a specific version:
GO111MODULE=on go get <package>@<version> - clean up
go.mod:GO111MODULE=on go mod tidy - update vendor directory:
GO111MODULE=on go mod vendor
GO111MODULE=on can be left out when using Go >= 1.13 or when the
source is checked out outside of $GOPATH.
go mod tidy must be used to ensure that the listed dependencies are
really still needed. Changing import statements or a tentative go get can result in stale dependencies.
The test-vendor verifies that it was used when run locally or in a
pre-merge CI job. If a vendor directory is present, it will also
verify that it's content is up-to-date.
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.
Conversion of a repository that uses dep to go mod can be done with:
GO111MODULE=on go mod init
release-tools/go-get-kubernetes.sh <current Kubernetes version from Gopkg.toml>
GO111MODULE=on go mod tidy
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
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