Skip to content

Commit 0341e16

Browse files
committed
Squashed 'release-tools/' changes from bc0504a..6616a6b
kubernetes-csi/csi-release-tools@6616a6b Merge kubernetes-csi/csi-release-tools#146 from pohly/kubernetes-1.21 kubernetes-csi/csi-release-tools@510fb0f prow.sh: support Kubernetes 1.21 kubernetes-csi/csi-release-tools@c63c61b prow.sh: add CSI_PROW_DEPLOYMENT_SUFFIX kubernetes-csi/csi-release-tools@51ac11c Merge kubernetes-csi/csi-release-tools#144 from pohly/pull-jobs kubernetes-csi/csi-release-tools@dd54c92 pull-test.sh: test importing csi-release-tools into other repo kubernetes-csi/csi-release-tools@7d2643a Merge kubernetes-csi/csi-release-tools#143 from pohly/path-setup kubernetes-csi/csi-release-tools@6880b0c prow.sh: avoid creating paths unless really running tests git-subtree-dir: release-tools git-subtree-split: 6616a6b5294b6df39cfce37f4fce7cdce0a77583
1 parent 09b2bd9 commit 0341e16

File tree

2 files changed

+63
-18
lines changed

2 files changed

+63
-18
lines changed

prow.sh

+31-18
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ kind_version_default () {
136136
case "${CSI_PROW_KUBERNETES_VERSION}" in
137137
latest|master)
138138
echo main;;
139+
1.21*|release-1.21)
140+
# TODO: replace this special case once the next KinD release supports 1.21.
141+
echo main;;
139142
*)
140143
echo v0.10.0;;
141144
esac
@@ -159,11 +162,6 @@ kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f
159162
# Use kind node-image --type=bazel by default, but allow to disable that.
160163
configvar CSI_PROW_USE_BAZEL true "use Bazel during 'kind node-image' invocation"
161164

162-
# Work directory. It has to allow running executables, therefore /tmp
163-
# is avoided. Cleaning up after the script is intentionally left to
164-
# the caller.
165-
configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csiprow.XXXXXXXXXX")" "work directory"
166-
167165
# By default, this script tests sidecars with the CSI hostpath driver,
168166
# using the install_csi_driver function. That function depends on
169167
# a deployment script that it searches for in several places:
@@ -190,8 +188,8 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
190188
# CSI_PROW_DEPLOYMENT variable can be set in the
191189
# .prow.sh of each component when there are breaking changes
192190
# that require using a non-default deployment. The default
193-
# is a deployment named "kubernetes-x.yy" (if available),
194-
# otherwise "kubernetes-latest".
191+
# is a deployment named "kubernetes-x.yy${CSI_PROW_DEPLOYMENT_SUFFIX}" (if available),
192+
# otherwise "kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}".
195193
# "none" disables the deployment of the hostpath driver.
196194
#
197195
# When no deploy script is found (nothing in `deploy` directory,
@@ -203,6 +201,7 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
203201
configvar CSI_PROW_DRIVER_VERSION "v1.3.0" "CSI driver version"
204202
configvar CSI_PROW_DRIVER_REPO https://github.com/kubernetes-csi/csi-driver-host-path "CSI driver repo"
205203
configvar CSI_PROW_DEPLOYMENT "" "deployment"
204+
configvar CSI_PROW_DEPLOYMENT_SUFFIX "" "additional suffix in kubernetes-x.yy[suffix].yaml files"
206205

207206
# The install_csi_driver function may work also for other CSI drivers,
208207
# as long as they follow the conventions of the CSI hostpath driver.
@@ -361,10 +360,23 @@ configvar CSI_SNAPSHOTTER_VERSION "$(default_csi_snapshotter_version)" "external
361360
# to all the K8s versions we test against
362361
configvar CSI_PROW_E2E_SKIP 'Disruptive|different\s+node' "tests that need to be skipped"
363362

364-
# This is the directory for additional result files. Usually set by Prow, but
365-
# if not (for example, when invoking manually) it defaults to the work directory.
366-
configvar ARTIFACTS "${CSI_PROW_WORK}/artifacts" "artifacts"
367-
mkdir -p "${ARTIFACTS}"
363+
# This creates directories that are required for testing.
364+
ensure_paths () {
365+
# Work directory. It has to allow running executables, therefore /tmp
366+
# is avoided. Cleaning up after the script is intentionally left to
367+
# the caller.
368+
configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csiprow.XXXXXXXXXX")" "work directory"
369+
370+
# This is the directory for additional result files. Usually set by Prow, but
371+
# if not (for example, when invoking manually) it defaults to the work directory.
372+
configvar ARTIFACTS "${CSI_PROW_WORK}/artifacts" "artifacts"
373+
mkdir -p "${ARTIFACTS}"
374+
375+
# For additional tools.
376+
CSI_PROW_BIN="${CSI_PROW_WORK}/bin"
377+
mkdir -p "${CSI_PROW_BIN}"
378+
PATH="${CSI_PROW_BIN}:$PATH"
379+
}
368380

369381
run () {
370382
echo "$(date) $(go version | sed -e 's/.*version \(go[^ ]*\).*/\1/') $(if [ "$(pwd)" != "${REPO_DIR}" ]; then pwd; fi)\$" "$@" >&2
@@ -384,11 +396,6 @@ die () {
384396
exit 1
385397
}
386398

387-
# For additional tools.
388-
CSI_PROW_BIN="${CSI_PROW_WORK}/bin"
389-
mkdir -p "${CSI_PROW_BIN}"
390-
PATH="${CSI_PROW_BIN}:$PATH"
391-
392399
# Ensure that PATH has the desired version of the Go tools, then run command given as argument.
393400
# Empty parameter uses the already installed Go. In Prow, that version is kept up-to-date by
394401
# bumping the container image regularly.
@@ -647,9 +654,9 @@ find_deployment () {
647654

648655
# Ignore: See if you can use ${variable//search/replace} instead.
649656
# shellcheck disable=SC2001
650-
file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')/deploy.sh"
657+
file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
651658
if ! [ -e "$file" ]; then
652-
file="$dir/kubernetes-latest/deploy.sh"
659+
file="$dir/kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
653660
if ! [ -e "$file" ]; then
654661
return 1
655662
fi
@@ -1098,6 +1105,9 @@ main () {
10981105
local images ret
10991106
ret=0
11001107
1108+
# Set up work directory.
1109+
ensure_paths
1110+
11011111
images=
11021112
if ${CSI_PROW_BUILD_JOB}; then
11031113
# A successful build is required for testing.
@@ -1259,6 +1269,9 @@ gcr_cloud_build () {
12591269
# Required for "docker buildx build --push".
12601270
gcloud auth configure-docker
12611271
1272+
# Might not be needed here, but call it just in case.
1273+
ensure_paths
1274+
12621275
if find . -name Dockerfile | grep -v ^./vendor | xargs --no-run-if-empty cat | grep -q ^RUN; then
12631276
# Needed for "RUN" steps on non-linux/amd64 platforms.
12641277
# See https://github.com/multiarch/qemu-user-static#getting-started

pull-test.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#! /bin/sh
2+
3+
# Copyright 2021 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script is called by pull Prow jobs for the csi-release-tools
18+
# repo to ensure that the changes in the PR work when imported into
19+
# some other repo.
20+
21+
set -ex
22+
23+
# It must be called inside the updated csi-release-tools repo.
24+
CSI_RELEASE_TOOLS_DIR="$(pwd)"
25+
26+
# Update the other repo.
27+
cd "$PULL_TEST_REPO_DIR"
28+
git subtree pull --squash --prefix=release-tools "$CSI_RELEASE_TOOLS_DIR" master
29+
git log -n2
30+
31+
# Now fall through to testing.
32+
exec ./.prow.sh

0 commit comments

Comments
 (0)