pulumi/build/travis/prepare-environment.sh
Pat Gavlin b47f9ef8ef
Point some scripts to the new scripts repo. (#1499)
All scripts that are generally useful across all builds have been moved
into `pulumi/scripts`. These changes clone that repository and retarget
the various scripts to their new location.
2018-06-12 10:03:43 -07:00

34 lines
1.3 KiB
Bash

# Travis sources this script, so we can export variables into the
# outer shell, so we don't want to set options like nounset because
# they would be set in the outer shell as well, so do as much logic as
# we can in a subshell.
export PULUMI_HOME="$(go env GOPATH)/src/github.com/pulumi/home"
export PULUMI_SCRIPTS="$(go env GOPATH)/src/github.com/pulumi/scripts"
(
set -o nounset -o errexit -o pipefail
if [ "${TRAVIS_OS_NAME:-}" = "osx" ]; then
sudo mkdir /opt/pulumi
sudo chown "${USER}" /opt/pulumi
fi
# We have some shared scripts in pulumi/home and pulumi/scripts that are used in other steps.
# We only clone the former if we have secure envvars.
if [ "${TRAVIS_SECURE_ENV_VARS:-}" = "true" ]; then
git clone git@github.com:pulumi/home "${PULUMI_HOME}"
fi
git clone git@github.com:pulumi/scripts "${PULUMI_SCRIPTS}"
# If we have an NPM token, put it in the .npmrc file, so we can use it:
if [ ! -z "${NPM_TOKEN:-}" ]; then
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc
fi
# Put static entries for Pulumi backends in /etc/hosts
"${PULUMI_SCRIPTS}/ci/pulumi-hosts" | sudo tee -a /etc/hosts
) || exit 1 # Abort outer script if subshell fails.
export PULUMI_ROOT=/opt/pulumi