Skip to content

Commit 6128d3d

Browse files
committed
Merge commit 'db8abb6e1bd35e848af082fc706c4546ded9315d' into HEAD
Imports the more flexible test driver config support.
2 parents cd0f09f + db8abb6 commit 6128d3d

File tree

3 files changed

+56
-23
lines changed

3 files changed

+56
-23
lines changed

release-tools/build.make

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,39 @@ test-fmt:
118118
fi
119119

120120
# This test only runs when dep >= 0.5 is installed, which is the case for the CI setup.
121+
# When using 'go mod', we allow the test to be skipped in the Prow CI under some special
122+
# circumstances, because it depends on accessing all remote repos and thus
123+
# running it all the time would defeat the purpose of vendoring:
124+
# - not handling a PR or
125+
# - the fabricated merge commit leaves go.mod, go.sum and vendor dir unchanged
126+
# - release-tools also didn't change (changing rules or Go version might lead to
127+
# a different result and thus must be tested)
121128
.PHONY: test-vendor
122129
test: test-vendor
123130
test-vendor:
124131
@ echo; echo "### $@:"
125-
@ case "$$(dep version 2>/dev/null | grep 'version *:')" in \
126-
*v0.[56789]*) dep check && echo "vendor up-to-date" || false;; \
127-
*) echo "skipping check, dep >= 0.5 required";; \
128-
esac
132+
@ if [ -f Gopkg.toml ]; then \
133+
echo "Repo uses 'dep' for vendoring."; \
134+
case "$$(dep version 2>/dev/null | grep 'version *:')" in \
135+
*v0.[56789]*) dep check && echo "vendor up-to-date" || false;; \
136+
*) echo "skipping check, dep >= 0.5 required";; \
137+
esac; \
138+
else \
139+
echo "Repo uses 'go mod' for vendoring."; \
140+
if [ "$${JOB_NAME}" ] && \
141+
( [ "$${JOB_TYPE}" != "presubmit" ] || \
142+
[ $$(git diff "${PULL_BASE_SHA}..HEAD" -- go.mod go.sum vendor release-tools | wc -l) -eq 0 ] ); then \
143+
echo "Skipping vendor check because the Prow pre-submit job does not change vendoring."; \
144+
elif ! GO111MODULE=on go mod vendor; then \
145+
echo "ERROR: vendor check failed."; \
146+
false; \
147+
elif [ $$(git status --porcelain -- vendor | wc -l) -gt 0 ]; then \
148+
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"; \
149+
git status -- vendor; \
150+
git diff -- vendor; \
151+
false; \
152+
fi; \
153+
fi;
129154

130155
.PHONY: test-subtree
131156
test: test-subtree

release-tools/prow.sh

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
154154
configvar CSI_PROW_HOSTPATH_VERSION fc52d13ba07922c80555a24616a5b16480350c3f "hostpath driver" # pre-1.1.0
155155
configvar CSI_PROW_HOSTPATH_REPO https://github.com/kubernetes-csi/csi-driver-host-path "hostpath repo"
156156
configvar CSI_PROW_DEPLOYMENT "" "deployment"
157+
configvar CSI_PROW_HOSTPATH_DRIVER_NAME "csi-hostpath" "the driver (aka provisioner) name of the chosen hostpath driver"
157158

158159
# If CSI_PROW_HOSTPATH_CANARY is set (typically to "canary", but also
159160
# "1.0-canary"), then all image versions are replaced with that
@@ -673,6 +674,29 @@ hostpath_supports_block () {
673674
echo "${result:-true}"
674675
}
675676
677+
# The default implementation of this function generates a external
678+
# driver test configuration for the hostpath driver.
679+
#
680+
# The content depends on both what the E2E suite expects and what the
681+
# installed hostpath driver supports. Generating it here seems prone
682+
# to breakage, but it is uncertain where a better place might be.
683+
generate_test_driver () {
684+
cat <<EOF
685+
ShortName: csiprow
686+
StorageClass:
687+
FromName: true
688+
SnapshotClass:
689+
FromName: true
690+
DriverInfo:
691+
Name: ${CSI_PROW_HOSTPATH_DRIVER_NAME}
692+
Capabilities:
693+
block: $(hostpath_supports_block)
694+
persistence: true
695+
dataSource: true
696+
multipods: true
697+
EOF
698+
}
699+
676700
# Captures pod output while running some other command.
677701
run_with_loggers () (
678702
loggers=$(start_loggers -f)
@@ -698,23 +722,7 @@ run_e2e () (
698722
# When running on a multi-node cluster, we need to figure out where the
699723
# hostpath driver was deployed and set ClientNodeName accordingly.
700724
701-
# The content of this file depends on both what the E2E suite expects and
702-
# what the installed hostpath driver supports. Generating it here seems
703-
# prone to breakage, but it is uncertain where a better place might be.
704-
cat >"${CSI_PROW_WORK}/hostpath-test-driver.yaml" <<EOF
705-
ShortName: csiprow
706-
StorageClass:
707-
FromName: true
708-
SnapshotClass:
709-
FromName: true
710-
DriverInfo:
711-
Name: csi-hostpath
712-
Capabilities:
713-
block: $(hostpath_supports_block)
714-
persistence: true
715-
dataSource: true
716-
multipods: true
717-
EOF
725+
generate_test_driver >"${CSI_PROW_WORK}/test-driver.yaml" || die "generating test-driver.yaml failed"
718726
719727
# Rename, merge and filter JUnit files. Necessary in case that we run the E2E suite again
720728
# and to avoid the large number of "skipped" tests that we get from using
@@ -727,7 +735,7 @@ EOF
727735
trap move_junit EXIT
728736
729737
cd "${GOPATH}/src/${CSI_PROW_E2E_IMPORT_PATH}" &&
730-
run_with_loggers ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/hostpath-test-driver.yaml"
738+
run_with_loggers ginkgo -v "$@" "${CSI_PROW_WORK}/e2e.test" -- -report-dir "${ARTIFACTS}" -storage.testdriver="${CSI_PROW_WORK}/test-driver.yaml"
731739
)
732740
733741
# Run csi-sanity against installed CSI driver.

release-tools/travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
- docker
55
matrix:
66
include:
7-
- go: 1.11.1
7+
- go: 1.12.4
88
before_script:
99
- mkdir -p bin
1010
- wget https://github.com/golang/dep/releases/download/v0.5.1/dep-linux-amd64 -O bin/dep

0 commit comments

Comments
 (0)