Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

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 committed Oct 12, 2016
1 parent 031c606 commit 1c660f1
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 5 deletions.
9 changes: 9 additions & 0 deletions bin/require-ci-golang-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/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 @@ -33,9 +33,9 @@ RUN cd /tmp && ./install-ruby.sh && rm install-ruby.sh
#global
ENV GOROOT /usr/local/go
ENV PATH $GOROOT/bin:$PATH
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

ADD root_bashrc /root/.bashrc

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
5 changes: 2 additions & 3 deletions ci/docker/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

set -eux

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

GO_ARCHIVE=$(basename $GO_ARCHIVE_URL)

echo "Downloading go..."
Expand Down
2 changes: 2 additions & 0 deletions ci/tasks/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ filename="bosh-init-${semver}-${GOOS}-${GOARCH}"

cd gopath/src/github.com/cloudfoundry/bosh-init

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-init
./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-init
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 GOPATH=$(pwd)/gopath
source /root/.bashrc

cd gopath/src/github.com/cloudfoundry/bosh-init
bin/require-ci-golang-version
bin/clean
bin/install-ginkgo
bin/test-prepare
Expand Down
1 change: 1 addition & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set -ex
bin=$(cd $(dirname $0)/../bin && pwd)

$bin/require-ci-golang-version
exec $bin/test

0 comments on commit 1c660f1

Please sign in to comment.