@@ -223,6 +223,10 @@ configvar CSI_PROW_SANITY_SERVICE "hostpath-service" "Kubernetes TCP service nam
223223configvar CSI_PROW_SANITY_POD " csi-hostpathplugin-0" " Kubernetes pod with CSI driver"
224224configvar CSI_PROW_SANITY_CONTAINER " hostpath" " Kubernetes container with CSI driver"
225225
226+ # The version of dep to use for 'make test-vendor'. Ignored if the project doesn't
227+ # use dep. Only binary releases of dep are supported (https://github.com/golang/dep/releases).
228+ configvar CSI_PROW_DEP_VERSION v0.5.1 " golang dep version to be used for vendor checking"
229+
226230# Each job can run one or more of the following tests, identified by
227231# a single word:
228232# - unit testing
@@ -396,6 +400,15 @@ install_ginkgo () {
396400 mv " $GOPATH /bin/ginkgo" " ${CSI_PROW_BIN} "
397401}
398402
403+ # Ensure that we have the desired version of dep.
404+ install_dep () {
405+ if dep version 2> /dev/null | grep -q " version:.*${CSI_PROW_DEP_VERSION} $" ; then
406+ return
407+ fi
408+ run curl --fail --location -o " ${CSI_PROW_WORK} /bin/dep" " https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64" &&
409+ chmod u+x " ${CSI_PROW_WORK} /bin/dep"
410+ }
411+
399412# This checks out a repo ("https://github.com/kubernetes/kubernetes")
400413# in a certain location ("$GOPATH/src/k8s.io/kubernetes") at
401414# a certain revision (a hex commit hash, v1.13.1, master). It's okay
@@ -936,6 +949,10 @@ main () {
936949 # changes in "release-tools" in a PR (that fails the "is release-tools unmodified"
937950 # test).
938951 if tests_enabled " unit" ; then
952+ if [ -f Gopkg.toml ] && ! install_dep; then
953+ warn " installing 'dep' failed, cannot test vendoring"
954+ ret=1
955+ fi
939956 if ! run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make -k test 2>&1 | make_test_to_junit; then
940957 warn " 'make test' failed, proceeding anyway"
941958 ret=1
0 commit comments