Implement edge-case handling for versioning
This commit is contained in:
parent
d6caf03301
commit
79dacf557e
27
abra
27
abra
@ -419,6 +419,12 @@ require_vendor_dir() {
|
||||
mkdir -p "$ABRA_VENDOR_DIR"
|
||||
}
|
||||
|
||||
require_consent_for_update() {
|
||||
if [ "$CONSENT_TO_UPDATE" = "false" ]; then
|
||||
error "A new app state will be deployed! Please use --update to consent"
|
||||
fi
|
||||
}
|
||||
|
||||
require_app_latest() {
|
||||
APP="$1"
|
||||
APP_DIR="$ABRA_DIR/apps/$APP"
|
||||
@ -496,6 +502,9 @@ load_abra_sh() {
|
||||
output_version_summary() {
|
||||
echo " Versions:"
|
||||
|
||||
CONSENT_TO_UPDATE=$abra___update
|
||||
IS_AN_UPDATE="false"
|
||||
|
||||
IFS=':' read -ra COMPOSE_FILES <<< "$COMPOSE_FILE"
|
||||
for COMPOSE in "${COMPOSE_FILES[@]}"; do
|
||||
SERVICES=$($YQ e '.services | keys | .[]' "${APP_DIR}/${COMPOSE}")
|
||||
@ -517,10 +526,24 @@ output_version_summary() {
|
||||
app_version=${!app_version_lookup}
|
||||
app_digest_lookup="ABRA_TYPE_${SERVICE^^}_DIGEST"
|
||||
app_digest=${!app_digest_lookup}
|
||||
echo " to de deployed: $(tput setaf 3)$app_version ($app_digest)$(tput sgr0)"
|
||||
|
||||
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)"
|
||||
fi
|
||||
|
||||
else
|
||||
warning "Unable to detect deployed version of ${STACK_NAME}_${SERVICE}, please proceed with caution"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [[ $IS_AN_UPDATE == "true" ]]; then
|
||||
require_consent_for_update
|
||||
else
|
||||
success "Nothing to deploy, you're on latest"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
###### FIXME 3wc: name this section
|
||||
@ -1745,7 +1768,7 @@ abra() {
|
||||
abra__subcommands_ abra___skip_update abra___skip_check \
|
||||
abra__backup_file_ abra___verbose abra___debug abra___help \
|
||||
abra___branch abra___volumes abra__provider_ abra___type \
|
||||
abra___dev
|
||||
abra___dev abra___update
|
||||
|
||||
if ! type tput > /dev/null 2>&1; then
|
||||
tput() {
|
||||
|
Loading…
Reference in New Issue
Block a user