Skip to content

Commit

Permalink
Introduce jenkins_setup command to be reused
Browse files Browse the repository at this point in the history
jenkins_setup in common.bash will also be used for the generator tests.
  • Loading branch information
ruflin committed Oct 6, 2017
1 parent ce9e47b commit eb87aca
Showing 3 changed files with 23 additions and 23 deletions.
18 changes: 18 additions & 0 deletions dev-tools/common.bash
Original file line number Diff line number Diff line change
@@ -78,3 +78,21 @@ setup_go_path() {

debug "GOPATH=${GOPATH}"
}

jenkins_setup() {
: "${HOME:?Need to set HOME to a non-empty value.}"
: "${WORKSPACE:?Need to set WORKSPACE to a non-empty value.}"

# Setup Go.
export GOPATH=${WORKSPACE}
export PATH=${GOPATH}/bin:${PATH}
if [ -f ".go-version" ]; then
eval "$(gvm $(cat .go-version))"
else
eval "$(gvm 1.7.5)"
fi

# Workaround for Python virtualenv path being too long.
export TEMP_PYTHON_ENV=$(mktemp -d)
export PYTHON_ENV="${TEMP_PYTHON_ENV}/python-env"
}
13 changes: 2 additions & 11 deletions dev-tools/jenkins_ci.sh
Original file line number Diff line number Diff line change
@@ -12,18 +12,9 @@ if [ ! -d "$beat" ]; then
exit
fi

# Setup Go.
export GOPATH=${WORKSPACE}
export PATH=${GOPATH}/bin:${PATH}
if [ -f ".go-version" ]; then
eval "$(gvm $(cat .go-version))"
else
eval "$(gvm 1.7.5)"
fi
source ./dev-tools/common.bash

# Workaround for Python virtualenv path being too long.
TEMP_PYTHON_ENV=$(mktemp -d)
export PYTHON_ENV="${TEMP_PYTHON_ENV}/python-env"
jenkins_setup

cleanup() {
echo "Running cleanup..."
15 changes: 3 additions & 12 deletions dev-tools/jenkins_intake.sh
Original file line number Diff line number Diff line change
@@ -4,18 +4,9 @@ set -euox pipefail
: "${HOME:?Need to set HOME to a non-empty value.}"
: "${WORKSPACE:?Need to set WORKSPACE to a non-empty value.}"

# Setup Go.
export GOPATH=${WORKSPACE}
export PATH=${GOPATH}/bin:${PATH}
if [ -f ".go-version" ]; then
eval "$(gvm $(cat .go-version))"
else
eval "$(gvm 1.7.5)"
fi
source ./dev-tools/common.bash

# Workaround for Python virtualenv path being too long.
TEMP_PYTHON_ENV=$(mktemp -d)
export PYTHON_ENV="${TEMP_PYTHON_ENV}/python-env"
jenkins_setup

cleanup() {
echo "Running cleanup..."
@@ -24,4 +15,4 @@ cleanup() {
}
trap cleanup EXIT

make check
make check

0 comments on commit eb87aca

Please sign in to comment.