Skip to content

Commit

Permalink
Introduce jenkins_setup command to be reused (#5315)
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 authored and andrewkroh committed Oct 9, 2017
1 parent 3ffa7c5 commit f9ac23f
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Up @@ -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..."
Expand Down
15 changes: 3 additions & 12 deletions dev-tools/jenkins_intake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -24,4 +15,4 @@ cleanup() {
}
trap cleanup EXIT

make check
make check

0 comments on commit f9ac23f

Please sign in to comment.