@@ -159,11 +159,6 @@ kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f
159
159
# Use kind node-image --type=bazel by default, but allow to disable that.
160
160
configvar CSI_PROW_USE_BAZEL true " use Bazel during 'kind node-image' invocation"
161
161
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
-
167
162
# By default, this script tests sidecars with the CSI hostpath driver,
168
163
# using the install_csi_driver function. That function depends on
169
164
# a deployment script that it searches for in several places:
@@ -361,10 +356,23 @@ configvar CSI_SNAPSHOTTER_VERSION "$(default_csi_snapshotter_version)" "external
361
356
# to all the K8s versions we test against
362
357
configvar CSI_PROW_E2E_SKIP ' Disruptive|different\s+node' " tests that need to be skipped"
363
358
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} "
359
+ # This creates directories that are required for testing.
360
+ ensure_paths () {
361
+ # Work directory. It has to allow running executables, therefore /tmp
362
+ # is avoided. Cleaning up after the script is intentionally left to
363
+ # the caller.
364
+ configvar CSI_PROW_WORK " $( mkdir -p " $GOPATH /pkg" && mktemp -d " $GOPATH /pkg/csiprow.XXXXXXXXXX" ) " " work directory"
365
+
366
+ # This is the directory for additional result files. Usually set by Prow, but
367
+ # if not (for example, when invoking manually) it defaults to the work directory.
368
+ configvar ARTIFACTS " ${CSI_PROW_WORK} /artifacts" " artifacts"
369
+ mkdir -p " ${ARTIFACTS} "
370
+
371
+ # For additional tools.
372
+ CSI_PROW_BIN=" ${CSI_PROW_WORK} /bin"
373
+ mkdir -p " ${CSI_PROW_BIN} "
374
+ PATH=" ${CSI_PROW_BIN} :$PATH "
375
+ }
368
376
369
377
run () {
370
378
echo " $( date) $( go version | sed -e ' s/.*version \(go[^ ]*\).*/\1/' ) $( if [ " $( pwd) " != " ${REPO_DIR} " ]; then pwd ; fi) \$ " " $@ " >&2
@@ -384,11 +392,6 @@ die () {
384
392
exit 1
385
393
}
386
394
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
-
392
395
# Ensure that PATH has the desired version of the Go tools, then run command given as argument.
393
396
# Empty parameter uses the already installed Go. In Prow, that version is kept up-to-date by
394
397
# bumping the container image regularly.
@@ -1098,6 +1101,9 @@ main () {
1098
1101
local images ret
1099
1102
ret=0
1100
1103
1104
+ # Set up work directory.
1105
+ ensure_paths
1106
+
1101
1107
images=
1102
1108
if ${CSI_PROW_BUILD_JOB} ; then
1103
1109
# A successful build is required for testing.
@@ -1259,6 +1265,9 @@ gcr_cloud_build () {
1259
1265
# Required for "docker buildx build --push".
1260
1266
gcloud auth configure-docker
1261
1267
1268
+ # Might not be needed here, but call it just in case.
1269
+ ensure_paths
1270
+
1262
1271
if find . -name Dockerfile | grep -v ^./vendor | xargs --no-run-if-empty cat | grep -q ^RUN; then
1263
1272
# Needed for "RUN" steps on non-linux/amd64 platforms.
1264
1273
# See https://github.com/multiarch/qemu-user-static#getting-started
0 commit comments