Squashed 'release-tools/' changes from f3255906..c0a4fb1d

https://github.com/kubernetes-csi/csi-release-tools/commit/c0a4fb1d 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/9c6a6c08 Master to main cleanup
https://github.com/kubernetes-csi/csi-release-tools/commit/682c686a 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/36a29f5c Merge https://github.com/kubernetes-csi/csi-release-tools/pull/163 from pohly/remove-bazel
https://github.com/kubernetes-csi/csi-release-tools/commit/68e43ca7 prow.sh: remove Bazel build support
https://github.com/kubernetes-csi/csi-release-tools/commit/c5f59c5a prow.sh: allow shell commands in CSI_PROW_SANITY_POD
https://github.com/kubernetes-csi/csi-release-tools/commit/71c810ab 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/9e438f8e prow.sh: fix mock testing
https://github.com/kubernetes-csi/csi-release-tools/commit/d7146c79 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/160 from pohly/kind-update
https://github.com/kubernetes-csi/csi-release-tools/commit/4b6aa609 prow.sh: update to KinD v0.11.0
https://github.com/kubernetes-csi/csi-release-tools/commit/7cdc76f3 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/ef8bd33b prow.sh: more flexible CSI_PROW_DEPLOYMENT, part II
https://github.com/kubernetes-csi/csi-release-tools/commit/204bc89c 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/61538bb7 prow.sh: more flexible CSI_PROW_DEPLOYMENT
https://github.com/kubernetes-csi/csi-release-tools/commit/2b0e6db9 Merge https://github.com/kubernetes-csi/csi-release-tools/pull/157 from humblec/csi-release
https://github.com/kubernetes-csi/csi-release-tools/commit/a2fcd6de Adding myself to csi reviewers group

git-subtree-dir: release-tools
git-subtree-split: c0a4fb1dd00b02879dbcea987e2e9524e4f5a905
This commit is contained in:
Patrick Ohly
2021-07-06 10:50:19 +02:00
parent a6a467e059
commit 4b91a98afd
4 changed files with 60 additions and 47 deletions

View File

@@ -21,6 +21,7 @@ aliases:
- chrishenzie - chrishenzie
- ggriffiths - ggriffiths
- gnufied - gnufied
- humblec
- j-griffith - j-griffith
- Jiawei0227 - Jiawei0227
- jingxu97 - jingxu97

View File

@@ -95,7 +95,7 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
1. Check [image build status](https://k8s-testgrid.appspot.com/sig-storage-image-build). 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 1. Promote images from k8s-staging-sig-storage to k8s.gcr.io/sig-storage. From
the [k8s image 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. 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. 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 1. Update [kubernetes-csi/docs](https://github.com/kubernetes-csi/docs) sidecar

View File

@@ -13,7 +13,7 @@
# See https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md # See https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
# for more details on image pushing process in Kubernetes. # 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). # This must be specified in seconds. If omitted, defaults to 600s (10 mins).
# Building three images in external-snapshotter takes roughly half an hour, # Building three images in external-snapshotter takes roughly half an hour,

102
prow.sh
View File

@@ -33,8 +33,6 @@
# The expected environment is: # The expected environment is:
# - $GOPATH/src/<import path> for the repository that is to be tested, # - $GOPATH/src/<import path> for the repository that is to be tested,
# with PR branch merged (when testing a PR) # 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 # - running on linux-amd64
# - kind (https://github.com/kubernetes-sigs/kind) installed # - kind (https://github.com/kubernetes-sigs/kind) installed
# - optional: Go already installed # - optional: Go already installed
@@ -139,11 +137,8 @@ kind_version_default () {
case "${CSI_PROW_KUBERNETES_VERSION}" in case "${CSI_PROW_KUBERNETES_VERSION}" in
latest|master) latest|master)
echo main;; 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 esac
} }
@@ -154,16 +149,14 @@ configvar CSI_PROW_KIND_VERSION "$(kind_version_default)" "kind"
# kind images to use. Must match the kind version. # kind images to use. Must match the kind version.
# The release notes of each kind release list the supported images. # The release notes of each kind release list the supported images.
configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab configvar CSI_PROW_KIND_IMAGES "kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
kindest/node:v1.19.7@sha256:a70639454e97a4b733f9d9b67e12c01f6b0297449d5b9cbbef87473458e26dca kindest/node:v1.20.7@sha256:e645428988191fc824529fd0bb5c94244c12401cf5f5ea3bd875eb0a787f0fe9
kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 kindest/node:v1.19.11@sha256:7664f21f9cb6ba2264437de0eb3fe99f201db7a3ac72329547ec4373ba5f5911
kindest/node:v1.17.17@sha256:7b6369d27eee99c7a85c48ffd60e11412dc3f373658bc59b7f4d530b7056823e kindest/node:v1.18.19@sha256:530378628c7c518503ade70b1df698b5de5585dcdba4f349328d986b8849b1ee
kindest/node:v1.16.15@sha256:c10a63a5bda231c0a379bf91aebf8ad3c79146daca59db816fb963f731852a99 kindest/node:v1.17.17@sha256:c581fbf67f720f70aaabc74b44c2332cc753df262b6c0bca5d26338492470c17
kindest/node:v1.15.12@sha256:67181f94f0b3072fb56509107b380e38c55e23bf60e6f052fbd8052d26052fb5 kindest/node:v1.16.15@sha256:430c03034cd856c1f1415d3e37faf35a3ea9c5aaa2812117b79e6903d1fc9651
kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f5ec34578f6180" "kind images" kindest/node:v1.15.12@sha256:8d575f056493c7778935dd855ded0e95c48cb2fab90825792e8fc9af61536bf9
kindest/node:v1.14.10@sha256:6033e04bcfca7c5f2a9c4ce77551e1abf385bcd2709932ec2f6a9c8c0aff6d4f" "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"
# By default, this script tests sidecars with the CSI hostpath driver, # By default, this script tests sidecars with the CSI hostpath driver,
# using the install_csi_driver function. That function depends on # 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. # in the e2e.test's normal YAML files.
# #
# The default is to enable this for all jobs which use canary images # 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 # and the latest Kubernetes because those images will be used for mock
# existing tests (the storage testsuites and mock testing in # testing once they are released. Using them for mock testing with
# Kubernetes). # older Kubernetes releases is too risky because the deployment files
configvar CSI_PROW_E2E_MOCK "$(if [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then echo true; else echo false; fi)" "enable CSI mock volume tests" # 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. # Regex for non-alpha, feature-tagged tests that should be run.
# #
@@ -591,17 +586,12 @@ start_cluster () {
if [ "$version" = "latest" ]; then if [ "$version" = "latest" ]; then
version=master version=master
fi 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" 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" 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 # Changing into the Kubernetes source code directory is a workaround for https://github.com/kubernetes-sigs/kind/issues/1910
# shellcheck disable=SC2046 # 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 csi_prow_kind_have_kubernetes=true
fi fi
image="csiprow/node:latest" 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 # Looks for the deployment as specified by CSI_PROW_DEPLOYMENT and CSI_PROW_KUBERNETES_VERSION
# in the given directory. # in the given directory.
find_deployment () { find_deployment () {
local dir file local dir="$1"
dir="$1" local file
# Fixed deployment name? Use it if it exists, otherwise fail.
if [ "${CSI_PROW_DEPLOYMENT}" ]; then
file="$dir/${CSI_PROW_DEPLOYMENT}/deploy.sh"
if ! [ -e "$file" ]; then
return 1
fi
echo "$file"
return 0
fi
# major/minor without release- prefix.
local k8sver
# Ignore: See if you can use ${variable//search/replace} instead. # Ignore: See if you can use ${variable//search/replace} instead.
# shellcheck disable=SC2001 # 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" 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
echo "$file"
return 0
fi
# CSI_PROW_DEPLOYMENT=kubernetes-x.yy must be mapped to kubernetes-latest
# as fallback. Same for kubernetes-distributed-x.yy.
fi
file="$dir/${deployment}/deploy.sh"
if ! [ -e "$file" ]; then 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 if ! [ -e "$file" ]; then
return 1 return 1
fi fi
@@ -969,7 +973,7 @@ run_e2e () (
# the full Kubernetes E2E testsuite while only running a few tests. # the full Kubernetes E2E testsuite while only running a few tests.
move_junit () { move_junit () {
if ls "${ARTIFACTS}"/junit_[0-9]*.xml 2>/dev/null >/dev/null; then 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 fi
} }
trap move_junit EXIT trap move_junit EXIT
@@ -982,9 +986,17 @@ run_e2e () (
run_sanity () ( run_sanity () (
install_sanity || die "installing csi-sanity failed" 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" <<EOF cat >"${CSI_PROW_WORK}/mkdir_in_pod.sh" <<EOF
#!/bin/sh #!/bin/sh
kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" -- mkdir "\$@" && echo "\$@" kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- mkdir "\$@" && echo "\$@"
EOF EOF
# Using "rm -rf" as fallback for "rmdir" is a workaround for: # Using "rm -rf" as fallback for "rmdir" is a workaround for:
# Node Service # Node Service
@@ -1009,8 +1021,8 @@ EOF
# why it happened. # why it happened.
cat >"${CSI_PROW_WORK}/rmdir_in_pod.sh" <<EOF cat >"${CSI_PROW_WORK}/rmdir_in_pod.sh" <<EOF
#!/bin/sh #!/bin/sh
if ! kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" -- rmdir "\$@"; then if ! kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- rmdir "\$@"; then
kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" -- rm -rf "\$@" kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- rm -rf "\$@"
exit 1 exit 1
fi fi
EOF EOF
@@ -1029,7 +1041,7 @@ else
fi fi
SCRIPT SCRIPT
) )
kubectl exec "${CSI_PROW_SANITY_POD}" -c "${CSI_PROW_SANITY_CONTAINER}" -- /bin/sh -c "\${CHECK_PATH}" kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- /bin/sh -c "\${CHECK_PATH}"
EOF EOF
chmod u+x "${CSI_PROW_WORK}"/*dir_in_pod.sh chmod u+x "${CSI_PROW_WORK}"/*dir_in_pod.sh