Re-factor version output logic and fix bug
It was showing empty strings for deployed versions it could not find. Now, it will not change messages to output if it can not detect the versions deployed (containers dont have the tag).
This commit is contained in:
parent
d3776f4424
commit
7f5e753dfd
48
abra
48
abra
@ -421,6 +421,24 @@ if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv
|
||||
error "direnv is blocked, run direnv allow"
|
||||
fi
|
||||
|
||||
require_consent_for_update (){
|
||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && \
|
||||
[ -n "$deployed_version" ] && \
|
||||
[ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||
error "This deployment will be an app update from version ${deployed_version} -> ${ABRA_TYPE_VERSION}
|
||||
Please pass the --update option to the deploy to deploy the update"
|
||||
fi
|
||||
|
||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && \
|
||||
[ "$ABRA_TYPE_VERSION" = "$deployed_version" ] && \
|
||||
[ "$ABRA_TYPE_DIGEST" != "$deployed_digest" ]; then
|
||||
error "The app version is the same but the image digest has changed from ${deployed_digest} -> ${ABRA_TYPE_DIGEST}
|
||||
This should not happen! This may mean that the upstream app developers are overwriting their image tags
|
||||
Get in touch and let's make the builds stable together: https://docs.cloud.autonomic.zone/contact/
|
||||
Please pass the --update option to deploy the update anyway"
|
||||
fi
|
||||
}
|
||||
|
||||
###### Run-time loading
|
||||
|
||||
load_abra_sh() {
|
||||
@ -887,26 +905,22 @@ sub_app_deploy (){
|
||||
deployed_version=$(echo "$deployed_version_digest" | cut -d- -f1)
|
||||
deployed_digest=$(echo "$deployed_version_digest" | cut -d- -f2)
|
||||
|
||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||
error "This deployment will be an app update from version ${deployed_version} -> ${ABRA_TYPE_VERSION}
|
||||
Please pass the --update option to the deploy to deploy the update"
|
||||
fi
|
||||
about_to_deploy_msg="About to deploy:"
|
||||
version_msg=" Version: $(tput setaf 2)${ABRA_TYPE_VERSION} (digest: ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||
|
||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && \
|
||||
[ "$ABRA_TYPE_VERSION" = "$deployed_version" ] && \
|
||||
[ "$ABRA_TYPE_DIGEST" != "$deployed_digest" ]; then
|
||||
error "The app version is the same but the image digest has changed from ${deployed_digest} -> ${ABRA_TYPE_DIGEST}
|
||||
This should not happen! This may mean that the upstream app developers are overwriting their image tags
|
||||
Get in touch and let's make the builds stable together: https://docs.cloud.autonomic.zone/contact/
|
||||
Please pass the --update option to deploy the update anyway"
|
||||
if [ -n "$deployed_version" ] && [ -n "$deployed_digest" ]; then
|
||||
require_consent_for_update
|
||||
|
||||
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||
about_to_deploy_msg="About to deploy (NEW VERSION):"
|
||||
fi
|
||||
|
||||
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||
echo "About to deploy (NEW VERSION):"
|
||||
else
|
||||
echo "About to deploy:"
|
||||
version_msg=" Version: $(tput setaf 2)$deployed_version -> ${ABRA_TYPE_VERSION} (digest: $deployed_digest -> ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$about_to_deploy_msg"
|
||||
echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)"
|
||||
|
||||
if [ "${COMPOSE_FILE/:/}" == "${COMPOSE_FILE}" ]; then
|
||||
@ -925,11 +939,7 @@ sub_app_deploy (){
|
||||
fi
|
||||
|
||||
if [ -n "$ABRA_TYPE_VERSION" ] && [ -n "$ABRA_TYPE_DIGEST" ]; then
|
||||
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||
echo " Version: $(tput setaf 2)$deployed_version -> ${ABRA_TYPE_VERSION} (digest: $deployed_digest -> ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||
else
|
||||
echo " Version: $(tput setaf 2)${ABRA_TYPE_VERSION} (digest: ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||
fi
|
||||
echo "$version_msg"
|
||||
fi
|
||||
|
||||
echo " Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
|
||||
|
Loading…
Reference in New Issue
Block a user