From 5a5c28d67df8375e8849b4ef851d4dc8dde7be4e Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 17 Feb 2020 17:38:32 +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 --- go.mod | 2 +- go.sum | 4 ++-- tekton/publish.yaml | 2 ++ tekton/release-pipeline.yaml | 4 +++- vendor/github.com/tektoncd/plumbing/gcp.md | 4 +++- .../tektoncd/plumbing/scripts/library.sh | 6 ++---- .../tektoncd/plumbing/scripts/presubmit-tests.sh | 16 ++++++++++++++-- vendor/modules.txt | 2 +- 8 files changed, 28 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index cd7ef42e9d2..903d2f368b6 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.0.5 // indirect github.com/rogpeppe/go-internal v1.3.2 // indirect github.com/shurcooL/githubv4 v0.0.0-20191102174205-af46314aec7b // indirect - github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9 + github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2 github.com/vdemeester/k8s-pkg-credentialprovider v1.13.12-1 // indirect go.opencensus.io v0.22.1 go.uber.org/zap v1.10.0 diff --git a/go.sum b/go.sum index 4a47f0affd4..3f6f7ffe4ad 100644 --- a/go.sum +++ b/go.sum @@ -498,8 +498,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9 h1:Iu6stVfs72OBV0c3srVX0oogjhLu+stqlvKHT41+pTI= -github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y= +github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2 h1:BksmpUwtap3THXJ8Z4KGcotsvpRdFQKySjDHgtc22lA= +github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y= github.com/tektoncd/plumbing/pipelinerun-logs v0.0.0-20191206114338-712d544c2c21/go.mod h1:S62EUWtqmejjJgUMOGB1CCCHRp6C706laH06BoALkzU= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= 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/gcp.md b/vendor/github.com/tektoncd/plumbing/gcp.md index c7e8f4f0224..2781f9df583 100644 --- a/vendor/github.com/tektoncd/plumbing/gcp.md +++ b/vendor/github.com/tektoncd/plumbing/gcp.md @@ -8,9 +8,11 @@ have access to. [`tekton-releases`](http://console.cloud.google.com/home/dashboard?project=tekton-releases) - The GKE cluster that [`Prow`](prow/README.md), `Tekton`, and [`boskos`](boskos/README.md) run in is called [`prow`](https://console.cloud.google.com/kubernetes/clusters/details/us-central1-a/prow?project=tekton-releases) +- The GKE cluster that is used for nightly releases and other dogfooding is called + [`dogfooding`](https://console.cloud.google.com/kubernetes/clusters/details/us-central1-a/dogfooding?project=tekton-releases) - The GCP project [`tekton-nightly`](http://console.cloud.google.com/home/dashboard?project=tekton-nightly) - is used for nightly releases + is used to hold nightly release artifacts This project and cluster are used for: diff --git a/vendor/github.com/tektoncd/plumbing/scripts/library.sh b/vendor/github.com/tektoncd/plumbing/scripts/library.sh index 81396ebc062..7c6f884b25a 100644 --- a/vendor/github.com/tektoncd/plumbing/scripts/library.sh +++ b/vendor/github.com/tektoncd/plumbing/scripts/library.sh @@ -333,7 +333,7 @@ function update_licenses() { local dst=$1 shift if [ -f "${REPO_ROOT_DIR}/go.mod" ]; then - run_go_tool github.com/google/go-licenses go-licenses save ./... --save_path=${dst} --force + go-licenses save ./... --save_path=${dst} --force # Hack to make sure directories retain write permissions after save. This # can happen if the directory being copied is a Go module. # See https://github.com/google/go-licenses/issues/11 @@ -347,10 +347,8 @@ function update_licenses() { # Parameters: $1...$n - directories and files to inspect. function check_licenses() { if [ -f "${REPO_ROOT_DIR}/go.mod" ]; then - run_go_tool github.com/google/go-licenses go-licenses check ./... + go-licenses check ./... else - # Fetch the google/licenseclassifier for its license db - go get -u github.com/google/licenseclassifier # Check that we don't have any forbidden licenses in our images. run_go_tool ./vendor/github.com/knative/test-infra/tools/dep-collector dep-collector -check $@ fi diff --git a/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh b/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh index 6a08c919a27..d1e2997b5cc 100644 --- a/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh +++ b/vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh @@ -44,6 +44,12 @@ IS_DOCUMENTATION_PR=0 # Directory to use for temporary files. WORK_DIR="" +# yamllint config file to override some rules, see https://git.io/JvLom +YAML_LINT_CONFIG=${YAML_LINT_CONFIG:-} + +# goflags to use to override default behavior (if a go.mod file and a vendor folder exists, set it "-mod=vendor") +GOFLAGS=${GOFLAGS:-} + # Returns true if PR only contains the given file regexes. # Parameters: $1 - file regexes, space separated. function pr_only_contains() { @@ -146,18 +152,22 @@ function markdown_build_tests() { # Perform yaml build tests if necessary, unless disabled. function yaml_build_tests() { + local yamllintargs + (( 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 echo "found ${file}" [[ -f "${file}" ]] && yamlfiles="${yamlfiles} ${file}" done + [[ -z "${yamlfiles}" ]] && return 0 - yamllint ${yamlfiles} + [[ -f ${YAML_LINT_CONFIG} ]] && yamllintargs="-c ${YAML_LINT_CONFIG}" + yamllint ${yamllintargs} ${yamlfiles} } # Default build test runner that: @@ -319,6 +329,8 @@ function main() { extra_initialization fi + [[ -z "${GOFLAGS}" ]] && [[ -e go.mod ]] && [[ -d vendor/ ]] && export GOFLAGS="-mod=vendor" + [[ -z $1 ]] && set -- "--all-tests" local TEST_TO_RUN="" diff --git a/vendor/modules.txt b/vendor/modules.txt index 82876bbf5b9..746977922f7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -271,7 +271,7 @@ github.com/shurcooL/graphql/internal/jsonutil github.com/sirupsen/logrus # github.com/spf13/pflag v1.0.5 github.com/spf13/pflag -# github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9 +# github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2 github.com/tektoncd/plumbing github.com/tektoncd/plumbing/scripts # github.com/vdemeester/k8s-pkg-credentialprovider v1.13.12-1