Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #5315 to 5.6: Introduce jenkins_setup command to be reused #5366

Merged
merged 1 commit into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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