@@ -85,6 +85,12 @@ get_versioned_variable () {
8585 echo " $value "
8686}
8787
88+ # If we have a vendor directory, then use it. We must be careful to only
89+ # use this for "make" invocations inside the project's repo itself because
90+ # setting it globally can break other go usages (like "go get <some command>"
91+ # which is disabled with GOFLAGS=-mod=vendor).
92+ configvar GOFLAGS_VENDOR " $( [ -d vendor ] && echo ' -mod=vendor' ) " " Go flags for using the vendor directory"
93+
8894# Go versions can be specified seperately for different tasks
8995# If the pre-installed Go is missing or a different
9096# version, the required version here will get installed
@@ -928,7 +934,7 @@ main () {
928934 images=
929935 if ${CSI_PROW_BUILD_JOB} ; then
930936 # A successful build is required for testing.
931- run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make all || die " 'make all' failed"
937+ run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make all " GOFLAGS_VENDOR= ${GOFLAGS_VENDOR} " || die " 'make all' failed"
932938 # We don't want test failures to prevent E2E testing below, because the failure
933939 # might have been minor or unavoidable, for example when experimenting with
934940 # changes in "release-tools" in a PR (that fails the "is release-tools unmodified"
@@ -938,13 +944,13 @@ main () {
938944 warn " installing 'dep' failed, cannot test vendoring"
939945 ret=1
940946 fi
941- if ! run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make -k test 2>&1 | make_test_to_junit; then
947+ if ! run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make -k test " GOFLAGS_VENDOR= ${GOFLAGS_VENDOR} " 2>&1 | make_test_to_junit; then
942948 warn " 'make test' failed, proceeding anyway"
943949 ret=1
944950 fi
945951 fi
946952 # Required for E2E testing.
947- run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make container || die " 'make container' failed"
953+ run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make container " GOFLAGS_VENDOR= ${GOFLAGS_VENDOR} " || die " 'make container' failed"
948954 fi
949955
950956 if tests_need_kind; then
0 commit comments