From cc176a2a34351d42fa955e15819d0f0cd81d394b Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 12 Feb 2020 12:58:00 +0100 Subject: [PATCH] =?UTF-8?q?Use=20vendor=20folder=20to=20speed=20up=20CI=20?= =?UTF-8?q?=F0=9F=A5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We still are using the `vendor` folder, so the CI should use this to build instead of trying to download the world. - It will speed up the CI - It will make sure we can build and test with what's in `vendor` This also updates release Task(s) and Pipeline(s) to use the `vendor` folder. Signed-off-by: Vincent Demeester --- tekton/publish.yaml | 2 ++ tekton/release-pipeline.yaml | 4 +++- vendor/github.com/tektoncd/plumbing/scripts/library.sh | 2 +- .../github.com/tektoncd/plumbing/scripts/presubmit-tests.sh | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tekton/publish.yaml b/tekton/publish.yaml index 006e3a9a53b..9f20c321761 100644 --- a/tekton/publish.yaml +++ b/tekton/publish.yaml @@ -111,6 +111,8 @@ spec: value: /workspace/go - name: GO111MODULE value: "off" + - name: GOFLAGS + value: "-mod=vendor" - name: CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE value: /secret/release.json script: | diff --git a/tekton/release-pipeline.yaml b/tekton/release-pipeline.yaml index 7a8b0e2a004..c9c1a4ea35d 100644 --- a/tekton/release-pipeline.yaml +++ b/tekton/release-pipeline.yaml @@ -76,6 +76,8 @@ spec: params: - name: package value: $(params.package) + - name: flags + value: -v -mod=vendor resources: inputs: - name: source @@ -88,7 +90,7 @@ spec: - name: package value: $(params.package) - name: flags - value: -ldflags "-X github.com/tektoncd/pipeline/pkg/version.PipelineVersion=$(params.versionTag)" + value: -mod=vendor -ldflags "-X github.com/tektoncd/pipeline/pkg/version.PipelineVersion=$(params.versionTag)" resources: inputs: - name: source diff --git a/vendor/github.com/tektoncd/plumbing/scripts/library.sh b/vendor/github.com/tektoncd/plumbing/scripts/library.sh index 81396ebc062..00431f6adc0 100644 --- a/vendor/github.com/tektoncd/plumbing/scripts/library.sh +++ b/vendor/github.com/tektoncd/plumbing/scripts/library.sh @@ -284,7 +284,7 @@ function report_go_test() { # Run tests in verbose mode to capture details. # go doesn't like repeating -v, so remove if passed. local args=" $@ " - local go_test="go test -race -v ${args/ -v / }" + local go_test="go test -mod=vendor -race -v ${args/ -v / }" # Just run regular go tests if not on Prow. echo "Running tests with '${go_test}'" local report=$(mktemp) diff --git a/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh b/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh index 6a08c919a27..7f7777250c8 100644 --- a/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh +++ b/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh @@ -149,7 +149,7 @@ function yaml_build_tests() { (( DISABLE_YAML_LINTING )) && return 0 subheader "Linting the yaml files" local yamlfiles="" - + for file in $(cat ${CHANGED_FILES}); do [[ -z $(echo "${file}" | grep '\.yaml$\|\.yml$' | grep -v '^vendor/' | grep -v '^third_party/') ]] && continue @@ -187,7 +187,7 @@ function default_build_test_runner() { [[ -z "${go_pkg_dirs}" ]] && return ${failed} # Ensure all the code builds subheader "Checking that go code builds" - go build -v ./... || failed=1 + go build -mod=vendor -v ./... || failed=1 # Get all build tags in go code. Ignore tags in /vendor, /third_party, and # tools for compatibility to allow for Go modules binary tool tracking. See # https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module @@ -195,7 +195,7 @@ function default_build_test_runner() { local tags="$(grep -r '// +build' . \ | grep -v '^./vendor/' | grep -v '^./third_party/' | grep -v "+build tools" | cut -f3 -d' ' | sort | uniq | tr '\n' ' ')" if [[ -n "${tags}" ]]; then - go test -run=^$ -tags="${tags}" ./... || failed=1 + go test -mod=vendor -run=^$ -tags="${tags}" ./... || failed=1 fi if [[ -f ./hack/verify-codegen.sh ]]; then subheader "Checking autogenerated code is up-to-date"