Skip to content

Commit

Permalink
🛠 fix prow presubmits
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeldeib committed Nov 25, 2019
1 parent 0742025 commit d2c8166
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
13 changes: 12 additions & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d2c8166

Please sign in to comment.