From 5341cd98f9c39c00ea1ae3fcbf6c5a62690708c3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 6 Jul 2021 10:53:44 +0200 Subject: [PATCH] Squashed 'release-tools/' changes from f3255906a..c0a4fb1dd https://github.com/kubernetes-csi/csi-release-tools/commit/c0a4fb1dd Merge https://github.com/kubernetes-csi/csi-release-tools/pull/164 from anubha-v-ardhan/patch-1 https://github.com/kubernetes-csi/csi-release-tools/commit/9c6a6c087 Master to main cleanup https://github.com/kubernetes-csi/csi-release-tools/commit/682c686ae Merge https://github.com/kubernetes-csi/csi-release-tools/pull/162 from pohly/pod-name-via-shell-command https://github.com/kubernetes-csi/csi-release-tools/commit/36a29f5c9 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/163 from pohly/remove-bazel https://github.com/kubernetes-csi/csi-release-tools/commit/68e43ca75 prow.sh: remove Bazel build support https://github.com/kubernetes-csi/csi-release-tools/commit/c5f59c5a1 prow.sh: allow shell commands in CSI_PROW_SANITY_POD https://github.com/kubernetes-csi/csi-release-tools/commit/71c810abd Merge https://github.com/kubernetes-csi/csi-release-tools/pull/161 from pohly/mock-test-fixes https://github.com/kubernetes-csi/csi-release-tools/commit/9e438f8e6 prow.sh: fix mock testing https://github.com/kubernetes-csi/csi-release-tools/commit/d7146c790 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/160 from pohly/kind-update https://github.com/kubernetes-csi/csi-release-tools/commit/4b6aa609e prow.sh: update to KinD v0.11.0 https://github.com/kubernetes-csi/csi-release-tools/commit/7cdc76f3e Merge https://github.com/kubernetes-csi/csi-release-tools/pull/159 from pohly/fix-deployment-selection https://github.com/kubernetes-csi/csi-release-tools/commit/ef8bd33b4 prow.sh: more flexible CSI_PROW_DEPLOYMENT, part II https://github.com/kubernetes-csi/csi-release-tools/commit/204bc89ce Merge https://github.com/kubernetes-csi/csi-release-tools/pull/158 from pohly/fix-deployment-selection https://github.com/kubernetes-csi/csi-release-tools/commit/61538bb77 prow.sh: more flexible CSI_PROW_DEPLOYMENT https://github.com/kubernetes-csi/csi-release-tools/commit/2b0e6db93 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/157 from humblec/csi-release https://github.com/kubernetes-csi/csi-release-tools/commit/a2fcd6de4 Adding myself to csi reviewers group git-subtree-dir: release-tools git-subtree-split: c0a4fb1dd00b02879dbcea987e2e9524e4f5a905 --- KUBERNETES_CSI_OWNERS_ALIASES | 1 + SIDECAR_RELEASE_PROCESS.md | 2 +- cloudbuild.yaml | 2 +- prow.sh | 96 ++++++++++++++++++++--------------- 4 files changed, 57 insertions(+), 44 deletions(-) diff --git a/KUBERNETES_CSI_OWNERS_ALIASES b/KUBERNETES_CSI_OWNERS_ALIASES index 6fb858aa38..8ea922edb8 100644 --- a/KUBERNETES_CSI_OWNERS_ALIASES +++ b/KUBERNETES_CSI_OWNERS_ALIASES @@ -21,6 +21,7 @@ aliases: - chrishenzie - ggriffiths - gnufied + - humblec - j-griffith - Jiawei0227 - jingxu97 diff --git a/SIDECAR_RELEASE_PROCESS.md b/SIDECAR_RELEASE_PROCESS.md index f5ec71b9ca..0cab8233c6 100644 --- a/SIDECAR_RELEASE_PROCESS.md +++ b/SIDECAR_RELEASE_PROCESS.md @@ -95,7 +95,7 @@ naming convention `-on-`. 1. Check [image build status](https://k8s-testgrid.appspot.com/sig-storage-image-build). 1. Promote images from k8s-staging-sig-storage to k8s.gcr.io/sig-storage. From the [k8s image - repo](https://github.com/kubernetes/k8s.io/tree/master/k8s.gcr.io/images/k8s-staging-sig-storage), + repo](https://github.com/kubernetes/k8s.io/tree/main/k8s.gcr.io/images/k8s-staging-sig-storage), run `./generate.sh > images.yaml`, and send a PR with the updated images. Once merged, the image promoter will copy the images from staging to prod. 1. Update [kubernetes-csi/docs](https://github.com/kubernetes-csi/docs) sidecar diff --git a/cloudbuild.yaml b/cloudbuild.yaml index b39a6db330..823fd1c5ae 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -13,7 +13,7 @@ # See https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md # for more details on image pushing process in Kubernetes. # -# To promote release images, see https://github.com/kubernetes/k8s.io/tree/master/k8s.gcr.io/images/k8s-staging-sig-storage. +# To promote release images, see https://github.com/kubernetes/k8s.io/tree/main/k8s.gcr.io/images/k8s-staging-sig-storage. # This must be specified in seconds. If omitted, defaults to 600s (10 mins). # Building three images in external-snapshotter takes roughly half an hour, diff --git a/prow.sh b/prow.sh index 55f2a91cfd..d1c7b27fab 100755 --- a/prow.sh +++ b/prow.sh @@ -33,8 +33,6 @@ # The expected environment is: # - $GOPATH/src/ for the repository that is to be tested, # with PR branch merged (when testing a PR) -# - optional: bazel installed (when testing against Kubernetes master), -# must be recent enough for Kubernetes master # - running on linux-amd64 # - kind (https://github.com/kubernetes-sigs/kind) installed # - optional: Go already installed @@ -139,11 +137,8 @@ kind_version_default () { case "${CSI_PROW_KUBERNETES_VERSION}" in latest|master) echo main;; - 1.21*|release-1.21) - # TODO: replace this special case once the next KinD release supports 1.21. - echo main;; *) - echo v0.10.0;; + echo v0.11.0;; esac } @@ -154,16 +149,14 @@ configvar CSI_PROW_KIND_VERSION "$(kind_version_default)" "kind" # kind images to use. Must match the kind version. # The release notes of each kind release list the supported images. -configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab -kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca -kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 -kindest/node:v1.17.17@sha256:7b6369d27eee99c7a85c48ffd60e11412dc3f373658bc59b7f4d530b7056823e -kindest/node:v1.16.15@sha256:c10a63a5bda231c0a379bf91aebf8ad3c79146daca59db816fb963f731852a99 -kindest/node:v1.15.12@sha256:67181f94f0b3072fb56509107b380e38c55e23bf60e6f052fbd8052d26052fb5 -kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f5ec34578f6180" "kind images" - -# Use kind node-image --type=bazel by default, but allow to disable that. -configvar CSI_PROW_USE_BAZEL true "use Bazel during 'kind node-image' invocation" +configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad +kindest/node:v1.20.7@sha256:e645428988191fc824529fd0bb5c94244c12401cf5f5ea3bd875eb0a787f0fe9 +kindest/node:v1.19.11@sha256:7664f21f9cb6ba2264437de0eb3fe99f201db7a3ac72329547ec4373ba5f5911 +kindest/node:v1.18.19@sha256:530378628c7c518503ade70b1df698b5de5585dcdba4f349328d986b8849b1ee +kindest/node:v1.17.17@sha256:c581fbf67f720f70aaabc74b44c2332cc753df262b6c0bca5d26338492470c17 +kindest/node:v1.16.15@sha256:430c03034cd856c1f1415d3e37faf35a3ea9c5aaa2812117b79e6903d1fc9651 +kindest/node:v1.15.12@sha256:8d575f056493c7778935dd855ded0e95c48cb2fab90825792e8fc9af61536bf9 +kindest/node:v1.14.10@sha256:6033e04bcfca7c5f2a9c4ce77551e1abf385bcd2709932ec2f6a9c8c0aff6d4f" "kind images" # By default, this script tests sidecars with the CSI hostpath driver, # using the install_csi_driver function. That function depends on @@ -305,10 +298,12 @@ tests_need_alpha_cluster () { # in the e2e.test's normal YAML files. # # The default is to enable this for all jobs which use canary images -# because we want to know whether our release candidates will pass all -# existing tests (the storage testsuites and mock testing in -# Kubernetes). -configvar CSI_PROW_E2E_MOCK "$(if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then echo true; else echo false; fi)" "enable CSI mock volume tests" +# and the latest Kubernetes because those images will be used for mock +# testing once they are released. Using them for mock testing with +# older Kubernetes releases is too risky because the deployment files +# can be very old (for example, still using a removed -provisioner +# parameter in external-provisioner). +configvar CSI_PROW_E2E_MOCK "$(if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ] && [ "${CSI_PROW_KUBERNETES_VERSION}" = "latest" ]; then echo true; else echo false; fi)" "enable CSI mock volume tests" # Regex for non-alpha, feature-tagged tests that should be run. # @@ -591,17 +586,12 @@ start_cluster () { if [ "$version" = "latest" ]; then version=master fi - if ${CSI_PROW_USE_BAZEL}; then - type="bazel" - else - type="docker" - fi git_clone https://github.com/kubernetes/kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$(version_to_git "$version")" || die "checking out Kubernetes $version failed" go_version="$(go_version_for_kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$version")" || die "cannot proceed without knowing Go version for Kubernetes" # Changing into the Kubernetes source code directory is a workaround for https://github.com/kubernetes-sigs/kind/issues/1910 # shellcheck disable=SC2046 - (cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image --image csiprow/node:latest $(if [ "$CSI_PROW_KIND_VERSION" != "main" ]; then echo --type="$type"; fi) --kube-root "${CSI_PROW_WORK}/src/kubernetes") || die "'kind build node-image' failed" + (cd "${CSI_PROW_WORK}/src/kubernetes" && run_with_go "$go_version" kind build node-image --image csiprow/node:latest --kube-root "${CSI_PROW_WORK}/src/kubernetes") || die "'kind build node-image' failed" csi_prow_kind_have_kubernetes=true fi image="csiprow/node:latest" @@ -654,24 +644,38 @@ delete_cluster_inside_prow_job() { # Looks for the deployment as specified by CSI_PROW_DEPLOYMENT and CSI_PROW_KUBERNETES_VERSION # in the given directory. find_deployment () { - local dir file - dir="$1" + local dir="$1" + local file - # Fixed deployment name? Use it if it exists, otherwise fail. + # major/minor without release- prefix. + local k8sver + # Ignore: See if you can use ${variable//search/replace} instead. + # shellcheck disable=SC2001 + k8sver="$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/^release-//' -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')" + + # Desired deployment, either specified completely, including version, or derived from other variables. + local deployment + deployment=${CSI_PROW_DEPLOYMENT:-kubernetes-${k8sver}${CSI_PROW_DEPLOYMENT_SUFFIX}} + + # Fixed deployment name? Use it if it exists. if [ "${CSI_PROW_DEPLOYMENT}" ]; then file="$dir/${CSI_PROW_DEPLOYMENT}/deploy.sh" - if ! [ -e "$file" ]; then - return 1 + if [ -e "$file" ]; then + echo "$file" + return 0 fi - echo "$file" - return 0 + + # CSI_PROW_DEPLOYMENT=kubernetes-x.yy must be mapped to kubernetes-latest + # as fallback. Same for kubernetes-distributed-x.yy. fi - # Ignore: See if you can use ${variable//search/replace} instead. - # shellcheck disable=SC2001 - file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh" + file="$dir/${deployment}/deploy.sh" if ! [ -e "$file" ]; then - file="$dir/kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh" + # Replace the first xx.yy number with "latest", for example + # kubernetes-1.21-test -> kubernetes-latest-test. + # Ignore: See if you can use ${variable//search/replace} instead. + # shellcheck disable=SC2001 + file="$dir/$(echo "$deployment" | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*/latest/')/deploy.sh" if ! [ -e "$file" ]; then return 1 fi @@ -969,7 +973,7 @@ run_e2e () ( # the full Kubernetes E2E testsuite while only running a few tests. move_junit () { if ls "${ARTIFACTS}"/junit_[0-9]*.xml 2>/dev/null >/dev/null; then - run_filter_junit -t="External Storage" -o "${ARTIFACTS}/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml && rm -f "${ARTIFACTS}"/junit_[0-9]*.xml + run_filter_junit -t="External.Storage|CSI.mock.volume" -o "${ARTIFACTS}/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml && rm -f "${ARTIFACTS}"/junit_[0-9]*.xml fi } trap move_junit EXIT @@ -982,9 +986,17 @@ run_e2e () ( run_sanity () ( install_sanity || die "installing csi-sanity failed" + if [[ "${CSI_PROW_SANITY_POD}" =~ " " ]]; then + # Contains spaces, more complex than a simple pod name. + # Evaluate as a shell command. + pod=$(eval "${CSI_PROW_SANITY_POD}") || die "evaluation failed: CSI_PROW_SANITY_POD=${CSI_PROW_SANITY_POD}" + else + pod="${CSI_PROW_SANITY_POD}" + fi + cat >"${CSI_PROW_WORK}/mkdir_in_pod.sh" <"${CSI_PROW_WORK}/rmdir_in_pod.sh" <