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"
|
error "direnv is blocked, run direnv allow"
|
||||||
fi
|
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
|
###### Run-time loading
|
||||||
|
|
||||||
load_abra_sh() {
|
load_abra_sh() {
|
||||||
@ -887,26 +905,22 @@ sub_app_deploy (){
|
|||||||
deployed_version=$(echo "$deployed_version_digest" | cut -d- -f1)
|
deployed_version=$(echo "$deployed_version_digest" | cut -d- -f1)
|
||||||
deployed_digest=$(echo "$deployed_version_digest" | cut -d- -f2)
|
deployed_digest=$(echo "$deployed_version_digest" | cut -d- -f2)
|
||||||
|
|
||||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
about_to_deploy_msg="About to deploy:"
|
||||||
error "This deployment will be an app update from version ${deployed_version} -> ${ABRA_TYPE_VERSION}
|
version_msg=" Version: $(tput setaf 2)${ABRA_TYPE_VERSION} (digest: ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||||
Please pass the --update option to the deploy to deploy the update"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CONSENT_TO_UPDATE" = "false" ] && \
|
if [ -n "$deployed_version" ] && [ -n "$deployed_digest" ]; then
|
||||||
[ "$ABRA_TYPE_VERSION" = "$deployed_version" ] && \
|
require_consent_for_update
|
||||||
[ "$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}
|
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||||
This should not happen! This may mean that the upstream app developers are overwriting their image tags
|
about_to_deploy_msg="About to deploy (NEW VERSION):"
|
||||||
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
|
fi
|
||||||
|
|
||||||
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
||||||
echo "About to deploy (NEW VERSION):"
|
version_msg=" Version: $(tput setaf 2)$deployed_version -> ${ABRA_TYPE_VERSION} (digest: $deployed_digest -> ${ABRA_TYPE_DIGEST})$(tput sgr0)"
|
||||||
else
|
fi
|
||||||
echo "About to deploy:"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$about_to_deploy_msg"
|
||||||
echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)"
|
echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)"
|
||||||
|
|
||||||
if [ "${COMPOSE_FILE/:/}" == "${COMPOSE_FILE}" ]; then
|
if [ "${COMPOSE_FILE/:/}" == "${COMPOSE_FILE}" ]; then
|
||||||
@ -925,11 +939,7 @@ sub_app_deploy (){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$ABRA_TYPE_VERSION" ] && [ -n "$ABRA_TYPE_DIGEST" ]; then
|
if [ -n "$ABRA_TYPE_VERSION" ] && [ -n "$ABRA_TYPE_DIGEST" ]; then
|
||||||
if [ "$ABRA_TYPE_VERSION" != "$deployed_version" ]; then
|
echo "$version_msg"
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
|
echo " Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
|
||||||
|
Reference in New Issue
Block a user