Skip to content

Commit

Permalink
Enforce CI pipelines running with expected go version
Browse files Browse the repository at this point in the history
  • Loading branch information
dpb587-pivotal authored and tjvman committed Oct 12, 2016
1 parent 57771c2 commit 0a106fb
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
10 changes: 10 additions & 0 deletions bin/require-ci-golang-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source ci/docker/deps-golang

if ! go version | grep -q " go$GO_VERSION " ; then
echo -n "DEBUG: " ; go version
echo "ERROR: expected version to be $GO_VERSION" >&2
exit 1
fi

4 changes: 2 additions & 2 deletions ci/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ RUN vagrant plugin install vagrant-aws
# bosh-init dependencies
RUN apt-get install -y mercurial && apt-get clean
# ...go
ADD install-go.sh /tmp/install-go.sh
ADD install-go.sh deps-golang /tmp/
RUN chmod a+x /tmp/install-go.sh
RUN cd tmp && ./install-go.sh && rm install-go.sh
RUN cd /tmp && ./install-go.sh && rm install-go.sh deps-golang

# lifecycle ssh test
RUN apt-get install -y sshpass && apt-get clean
Expand Down
3 changes: 3 additions & 0 deletions ci/docker/deps-golang
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GO_VERSION=1.7.1
GO_ARCHIVE_SHA256=43ad621c9b014cde8db17393dc108378d37bc853aa351a6c74bf6432c1bbd182
GO_ARCHIVE_URL=https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz
3 changes: 1 addition & 2 deletions ci/docker/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

set -ex

source deps-golang
GOROOT=/usr/local/go
GO_ARCHIVE_URL=https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
GO_ARCHIVE_SHA256=43ad621c9b014cde8db17393dc108378d37bc853aa351a6c74bf6432c1bbd182
GO_ARCHIVE=$(basename $GO_ARCHIVE_URL)

echo "Downloading go..."
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ timestamp=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
filename="bosh-cli-${semver}-${GOOS}-${GOARCH}"

cd gopath/src/github.com/cloudfoundry/bosh-cli
bin/require-ci-golang-version

git_rev=`git rev-parse --short HEAD`
version="${semver}-${git_rev}-${timestamp}"
Expand Down
1 change: 1 addition & 0 deletions ci/tasks/test-acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ set -x
export BOSH_LITE_PRIVATE_KEY=$tmpfile

cd $GOPATH/src/github.com/cloudfoundry/bosh-cli
./bin/require-ci-golang-version
base=$PWD ./bin/test-acceptance-with-vm --provider=aws
1 change: 1 addition & 0 deletions ci/tasks/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH
export GOPATH=$(pwd)/gopath

cd gopath/src/github.com/cloudfoundry/bosh-cli
bin/require-ci-golang-version
bin/clean
bin/install-ginkgo
bin/test-integration
1 change: 1 addition & 0 deletions ci/tasks/test-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH
export GOPATH=$(pwd)/gopath

cd gopath/src/github.com/cloudfoundry/bosh-cli
bin/require-ci-golang-version
bin/clean
bin/install-ginkgo
bin/test-prepare
Expand Down

0 comments on commit 0a106fb

Please sign in to comment.