From a6484f4545eb392e956124e23abb0b1f77247317 Mon Sep 17 00:00:00 2001 From: Axel Haustant Date: Thu, 10 Jan 2019 10:09:55 +0100 Subject: [PATCH] Gitlab CI compatibility --- entrypoint.sh | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f26a3e1..def3739 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -60,19 +60,26 @@ if [[ ! -z "${ANSIBLE_VAULT_PASSWORD}" ]]; then echo "$ANSIBLE_VAULT_PASSWORD" > $ANSIBLE_VAULT_PASSWORD_FILE fi -case $1 in - playbook) - shift - ansible-playbook "$@" - ;; - shell) - /bin/ash - ;; - sh) - shift - /bin/ash -c "$@" - ;; - *) - ansible "$@" - ;; -esac +if [[ ! -z "${CI_JOB_ID}" ]]; then + case $1 in + playbook) + shift + ansible-playbook "$@" + ;; + shell) + /bin/ash + ;; + sh) + shift + /bin/ash -c "$@" + ;; + *) + ansible "$@" + ;; + esac +else + # We are in a CI pipeline + # Just spawn a shell for compatibility + /bin/ash +fi +