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
Robert Kaussow c9cd6d68e9
All checks were successful
continuous-integration/drone/push Build is passing
allow unset variables in entrypoint script
2019-09-23 11:25:35 +02:00

26 lines
678 B
Bash
Executable File

#!/usr/bin/env bash
set -o pipefail
set -o errtrace
set -o errexit
if [ "$GCE_SSH_KEY" ]; then
echo "$GCE_SSH_KEY" > $HOME/.ssh/google_compute_engine
chmod 600 $HOME/.ssh/google_compute_engine
fi
if [ "$GCE_CREDENTIALS_JSON" ] && [ "$GCE_CREDENTIALS_FILE" ]; then
DIR=$(dirname "$GCE_CREDENTIALS_FILE")
mkdir -p "${DIR}"
echo "$GCE_CREDENTIALS_JSON" > "$GCE_CREDENTIALS_FILE"
fi
if [ "${MOLECULE_CUSTOM_MODULES_REPO}" ]; then
mkdir ./library/
git clone "$MOLECULE_CUSTOM_MODULES_REPO" ./library/
fi
if [ "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
mkdir -p ./plugins/filters/
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" ./plugins/filters/
fi