From 47dac6b4ef5992154f555198f4d458cb2fe8d38f Mon Sep 17 00:00:00 2001
From: "Guillaume B.B. Van Hemmen" <GuillaumeHemmen@noreply.git.van-hemmen.com>
Date: Mon, 19 May 2025 13:18:13 +0200
Subject: [PATCH] #4 - Add logging of environment variables and build actions

This change introduces logging of key environment variables used during the build process, with sensitive values partially masked for security. It also provides clear messaging on whether the build includes a push to the registry, improving transparency and debugging capabilities.
---
 build.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/build.sh b/build.sh
index d6ffddb..42e2e99 100644
--- a/build.sh
+++ b/build.sh
@@ -69,6 +69,28 @@ fi
 
 echo "Kaniko will be called with:${DEST_FLAGS}"
 
+###############################################################################
+# resume what will be done
+###############################################################################
+echo "Environment Variables:"
+echo "KANIKO_CONTEXT=${KANIKO_CONTEXT}"
+echo "GITHUB_REF_NAME=${GITHUB_REF_NAME}"
+echo "GIT_USERNAME=${GIT_USERNAME}"
+echo "GIT_PASSWORD=$(echo "${GIT_PASSWORD}" | sed 's/\(^..\).*\(..$\)/\1...\2/')"
+echo "REGISTRY_HOST=${REGISTRY_HOST}"
+echo "REGISTRY_USER=${REGISTRY_USER}"
+[ -n "${REGISTRY_PASS}" ] && echo "REGISTRY_PASS=$(echo "${REGISTRY_PASS}" | sed 's/\(^..\).*\(..$\)/\1...\2/')"
+echo "KANIKO_DESTINATION=${KANIKO_DESTINATION}"
+echo "KANIKO_VERBOSITY=${KANIKO_VERBOSITY}"
+echo "KANIKO_DOCKERFILE=${KANIKO_DOCKERFILE}"
+echo ""
+if [ "${DEST_FLAGS}" = "--no-push" ]; then
+  echo "Action: Build only (no push)"
+else
+  echo "Action: Build and push"
+fi
+echo ""
+
 ###############################################################################
 # Invoke Kaniko
 ###############################################################################