From d2c8166ef88d316a042f455506a68b2ab75c9360 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 14 Nov 2019 13:38:14 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20fix=20prow=20presubmits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 - common.sh | 13 ++++++++++++- scripts/setup.sh | 3 +-- test_e2e.sh | 5 ++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c4c8145ee6..8ef718368c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,6 @@ services: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p /Users/travis/gopath/bin; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scripts/setup.sh $KIND_K8S_VERSION; fi before_script: diff --git a/common.sh b/common.sh index da4407742e..a31bbb05a9 100644 --- a/common.sh +++ b/common.sh @@ -156,7 +156,7 @@ function install_dep_by_git { DEP_LATEST=$(git describe --abbrev=0 --tags) git checkout $DEP_LATEST mkdir bin - go build -ldflags="-X main.version=$DEP_LATEST" -o bin/dep ./cmd/dep + GO111MODULE=off go build -ldflags="-X main.version=$DEP_LATEST" -o bin/dep ./cmd/dep popd fi } @@ -170,6 +170,17 @@ function install_go_dep { fi } +function install_kind { + header_text "Checking for kind" + if ! is_installed kind ; then + header_text "Installing kind" + KIND_DIR=$(mktemp -d) + pushd $KIND_DIR + GO111MODULE=on go get sigs.k8s.io/kind@v0.6.0 + popd + fi +} + function is_installed { if command -v $1 &>/dev/null; then return 0 diff --git a/scripts/setup.sh b/scripts/setup.sh index 050134cdd8..01591cb5c9 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -19,10 +19,9 @@ K8S_VERSION=$1 export GO111MODULE=on # setup go module to create the cluster -go get sigs.k8s.io/kind@v0.5.1 # You can use --image flag to specify the cluster version you want, e.g --image=kindest/node:v1.13.6, the supported version are listed at https://hub.docker.com/r/kindest/node/tags -kind create cluster --config test/kind-config.yaml --image=kindest/node:$K8S_VERSION +kind create cluster -v 4 --retain --wait=1m --config test/kind-config.yaml --image=kindest/node:$K8S_VERSION # setup the go modules required go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.2 diff --git a/test_e2e.sh b/test_e2e.sh index 2bc8f81f63..8f4df1810d 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -23,11 +23,14 @@ export TRACE=1 export GO111MODULE=on fetch_tools -install_go_dep +# This test is used by prow and if the dep not be installed by git then it will face the GOBIN issue. +install_dep_by_git +install_kind build_kb setup_envs +source "$(pwd)/scripts/setup.sh" ${KIND_K8S_VERSION} docker pull gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 kind load docker-image gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1