2018-01-24 00:56:58 +01:00
|
|
|
# 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.
|
2018-03-08 20:34:25 +01:00
|
|
|
|
|
|
|
export PULUMI_HOME="$(go env GOPATH)/src/github.com/pulumi/home"
|
2018-06-12 19:03:43 +02:00
|
|
|
export PULUMI_SCRIPTS="$(go env GOPATH)/src/github.com/pulumi/scripts"
|
2018-03-08 20:34:25 +01:00
|
|
|
|
2018-01-24 00:56:58 +01:00
|
|
|
(
|
|
|
|
set -o nounset -o errexit -o pipefail
|
|
|
|
|
|
|
|
if [ "${TRAVIS_OS_NAME:-}" = "osx" ]; then
|
|
|
|
sudo mkdir /opt/pulumi
|
|
|
|
sudo chown "${USER}" /opt/pulumi
|
|
|
|
fi
|
|
|
|
|
2018-06-12 19:03:43 +02:00
|
|
|
# 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}"
|
2018-01-24 00:56:58 +01:00
|
|
|
|
|
|
|
# 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
|
2018-04-27 07:54:39 +02:00
|
|
|
|
|
|
|
# Put static entries for Pulumi backends in /etc/hosts
|
2018-06-12 19:03:43 +02:00
|
|
|
"${PULUMI_SCRIPTS}/ci/pulumi-hosts" | sudo tee -a /etc/hosts
|
2018-03-08 20:34:25 +01:00
|
|
|
) || exit 1 # Abort outer script if subshell fails.
|
2018-01-24 00:56:58 +01:00
|
|
|
|
|
|
|
export PULUMI_ROOT=/opt/pulumi
|