From e6f9c95fcb26f679885b31d8f3e70d3c8f4189ac Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Mon, 20 May 2024 22:54:46 +0200 Subject: [PATCH] fix date and buildname --- init.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init.sh b/init.sh index a6f537f..8d79be9 100755 --- a/init.sh +++ b/init.sh @@ -2,7 +2,7 @@ # check if all required variables are set if [ -z "$APP" ] || [ -z "$PHASE" ] || [ -z "$PIPELINE" ] || [ -z "$REPOSITORY" ] || [ -z "$TAG" ] || [ -z "$SERVICE_ACCOUNT" ] || [ -z "$BUILDER" ] || [ -z "$URL" ] || [ -z "$REVISION" ]; then - echo "$(date -u) One or more required variables are not set" + echo "$(date) One or more required variables are not set" exit 1 fi @@ -25,7 +25,7 @@ EOF # check if kubectl command failed if [ $? -ne 0 ]; then - echo "$(date -u) Failed to create build pod" + echo "$(date) Failed to create build pod" exit 1 fi @@ -33,16 +33,16 @@ sleep 2 ## check with kubectl if the pod is completed while true; do - PHASE=$(kubectl get pod ${NAME}-build-pod -o jsonpath='{.status.phase}') + PHASE=$(kubectl get pod ${APP}-${TAG}-build-pod -o jsonpath='{.status.phase}') if [ "$PHASE" == "Succeeded" ]; then - echo "$(date -u) Build completed successfully" + echo "$(date) Build completed successfully" break fi if [ "$PHASE" == "Failed" ]; then - echo "$(date -u) uild failed" + echo "$(date) uild failed" break fi - echo "$(date -u) Waiting for build to complete...$PHASE" + echo "$(date) Waiting for build to complete...$PHASE" sleep 1 done @@ -51,9 +51,9 @@ sleep 2 # patch kuberoes resource with the new image kubectl patch --type=merge kuberoapps.application.kubero.dev ${APP} -p "{\"spec\":{\"image\":{\"repository\":\"${REPOSITORY}\",\"tag\":\"${TAG}\"}}}" if [ $? -ne 0 ]; then - echo "$(date -u) Failed to patch kubero app resource" + echo "$(date) Failed to patch kubero app resource" exit 1 fi -echo "$(date -u) Successfully patched kubero app resource" +echo "$(date) Successfully patched kubero app resource" exit 0 \ No newline at end of file