Use local marker and scan services only once
This commit is contained in:
parent
bc0ef0d6fc
commit
b04bfea1c7
13
abra
13
abra
@ -503,14 +503,21 @@ output_version_summary() {
|
||||
echo " Versions:"
|
||||
|
||||
CONSENT_TO_UPDATE=$abra___update
|
||||
IS_AN_UPDATE="false"
|
||||
UNABLE_TO_DETECT="false"
|
||||
|
||||
local -a IS_AN_UPDATE="false"
|
||||
local -a UNABLE_TO_DETECT="false"
|
||||
local -a CHECKED_SERVICES # array
|
||||
|
||||
IFS=':' read -ra COMPOSE_FILES <<< "$COMPOSE_FILE"
|
||||
for COMPOSE in "${COMPOSE_FILES[@]}"; do
|
||||
SERVICES=$($YQ e '.services | keys | .[]' "${APP_DIR}/${COMPOSE}")
|
||||
|
||||
for SERVICE in $SERVICES; do
|
||||
if [[ "${CHECKED_SERVICES[@]}" =~ "${SERVICE}" ]]; then
|
||||
debug "already inspected ${STACK_NAME}_${SERVICE} for versions, skipping..."
|
||||
continue
|
||||
fi
|
||||
|
||||
filter="{{index .Spec.Labels \"coop-cloud.$STACK_NAME.$SERVICE.version\" }}"
|
||||
label=$(docker service inspect -f "$filter" "${STACK_NAME}_${SERVICE}" 2>/dev/null)
|
||||
|
||||
@ -532,11 +539,11 @@ output_version_summary() {
|
||||
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"
|
||||
UNABLE_TO_DETECT="true"
|
||||
fi
|
||||
CHECKED_SERVICES+=("$SERVICE")
|
||||
done
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user