From 73291c00ac2b8b2276a02b060c9f46a07bce45be Mon Sep 17 00:00:00 2001 From: Lars Gohlke Date: Wed, 23 Oct 2024 13:56:58 +0200 Subject: [PATCH] adds quirks to make terraform plan less noisy --- tools/terraform.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/terraform.sh b/tools/terraform.sh index 6cd07b9..086b394 100644 --- a/tools/terraform.sh +++ b/tools/terraform.sh @@ -128,6 +128,14 @@ function tf_plan { # shellcheck disable=SC2155 local output=$(mktemp) + if [[ $HOSTNAME =~ "bwpm-"* ]]; then + export CI=true + export CI_COMMIT_REF_NAME=$(git branch --show-current) + local remote=$(git config get branch.main.remote) + export CI_PROJECT_URL=$(git remote get-url "$remote" | sed -e 's|.*@ssh.||; s|:|/|; s|^|https://|; s|.git$||') + export CI_PROJECT_DIR=$(git rev-parse --show-toplevel) + fi + if ! terraform validate; then echo "stopped on error" return