This repository has been archived on 2024-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
molecule/gce-entrypoint.sh

30 lines
824 B
Bash
Raw Normal View History

2019-03-12 10:18:14 +00:00
#!/usr/bin/env bash
2019-03-18 13:45:18 +00:00
set -o pipefail
set -o errtrace
set -o nounset
set -o errexit
2019-03-12 10:18:14 +00:00
ANSIBLE_ROLES_PATH=${ANSIBLE_ROLES_PATH:-/drone/src}
MOLECULE_REQUIREMENTS_FILE=${MOLECULE_REQUIREMENTS_FILE:-./requirements.yml}
2019-03-12 13:00:18 +00:00
if [ "$GCE_SSH_KEY" ]; then
echo "$GCE_SSH_KEY" > $HOME/.ssh/google_compute_engine
2019-03-12 10:18:14 +00:00
chmod 600 $HOME/.ssh/google_compute_engine
fi
2019-03-12 13:00:18 +00:00
if [ "$GCE_CREDENTIALS_JSON" ] && [ "$GCE_CREDENTIALS_FILE" ]; then
DIR=$(dirname "$GCE_CREDENTIALS_FILE")
2019-03-12 10:18:14 +00:00
mkdir -p "${DIR}"
2019-03-12 13:00:18 +00:00
echo "$GCE_CREDENTIALS_JSON" > "$GCE_CREDENTIALS_FILE"
2019-03-12 10:18:14 +00:00
fi
if [ "${MOLECULE_CUSTOM_MODULES_REPO}" ]; then
mkdir ./library/
2019-03-12 13:00:18 +00:00
git clone "$MOLECULE_CUSTOM_MODULES_REPO" ./library/
2019-03-12 10:18:14 +00:00
fi
2019-05-12 21:17:42 +00:00
2019-05-12 21:21:29 +00:00
if [ "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
2019-05-12 21:38:48 +00:00
mkdir -p ./plugins/filters/
2019-05-12 21:21:29 +00:00
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" ./plugins/filters/
2019-05-12 21:17:42 +00:00
fi