From c3e3f0a1f8942ceb89fd2553a20d15c5243c2c26 Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Sun, 4 Apr 2021 14:29:29 +0200 Subject: [PATCH] Use version info from compose file(s) not abra.sh Ref #131 --- abra | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/abra b/abra index 038642a..4903cac 100755 --- a/abra +++ b/abra @@ -614,19 +614,20 @@ output_version_summary() { live_digest=$(echo "$label" | cut -d- -f2) if [ -n "$live_version" ] && [ -n "$live_digest" ]; then - image=$($YQ e ".services.${SERVICE}.image" "${APP_DIR}/${COMPOSE}" | cut -d':' -f1) + service_data=$($YQ e ".services.${SERVICE}" "${APP_DIR}/${COMPOSE}") + service_image=$(echo "$service_data" | $YQ e ".image" - | cut -d':' -f1) + service_version=$(echo "$service_data" | $YQ e ".deploy.labels[] | select(. == \"coop*\")" - | cut -d'=' -f2) + service_tag="${service_version%-*}" + service_digest="${service_version##*-}" - echo " ${STACK_NAME}_${SERVICE} (${image}):" + echo " ${STACK_NAME}_${SERVICE} (${service_image}):" echo " deployed: $(tput setaf 2)$live_version ($live_digest)$(tput sgr0)" - app_version_lookup="ABRA_TYPE_${SERVICE^^}_VERSION" - app_version=${!app_version_lookup} - app_digest_lookup="ABRA_TYPE_${SERVICE^^}_DIGEST" - app_digest=${!app_digest_lookup} - - if [ "$live_version" != "$app_version" ] || [ "$live_digest" != "$app_digest" ]; then - IS_AN_UPDATE="true" - echo " to de deployed: $(tput setaf 1)$app_version ($app_digest)$(tput sgr0)" + if [[ -z "$IS_VERSION_CHECK" ]] || [[ "$IS_VERSION_CHECK" != "true" ]]; then + if [ "$live_version" != "$service_tag" ] || [ "$live_digest" != "$service_digest" ]; then + IS_AN_UPDATE="true" + fi + echo " to be deployed: $(tput setaf 1)$service_version ($service_digest)$(tput sgr0)" fi else if [[ $UNDEPLOYED_STATE == "true" ]]; then