Make logging reflect reality + do more debugging
continuous-integration/drone/push Build is failing Details

See #193.
This commit is contained in:
decentral1se 2021-07-04 21:51:55 +02:00
parent bb3b324e07
commit 43b4a01f8a
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 7 additions and 4 deletions

11
abra
View File

@ -800,25 +800,29 @@ ensure_stack_deployed() {
idx=0
IFS=' ' read -r -a SERVICES <<< "$(docker stack services "${STACK_NAME}" --format "{{.ID}}" | tr '\n' ' ')"
debug "Considering the following service IDs: ${SERVICES} for ${STACK_NAME} deployment"
while [ ! $(( ${#HEALTHY[@]} + ${#MISSING[@]} )) -eq ${#SERVICES[@]} ]; do
for service in $(docker ps -f "name=$STACK_NAME" -q); do
debug "Polling $service for deployment status"
healthcheck=$(docker inspect --format "{{ json .State }}" "$service" | jq "try(.Health.Status // \"missing\")")
name=$(docker inspect --format '{{ index .Config.Labels "com.docker.swarm.service.name" }}' "$service")
if [[ ${MISSING[*]} =~ ${name} ]] || [[ ${HEALTHY[*]} =~ ${name} ]]; then
debug "$name already marked as missing healthcheck / healthy status"
continue
fi
if [[ "$healthcheck" == "\"missing\"" ]] && [[ ! "${MISSING[*]}" =~ $name ]]; then
MISSING+=("$name")
info "$name has no healthcheck configured, cannot guarantee this service comes up successfully..."
debug "No healthcheck configured for $name"
continue
fi
if [[ "$healthcheck" == "\"healthy\"" ]] && [[ ! "${HEALTHY[*]}" =~ $name ]]; then
HEALTHY+=("$name")
info "$name is healthy!"
debug "Marking $name with healthy status"
continue
fi
@ -837,9 +841,8 @@ ensure_stack_deployed() {
fi
sleep 1
info "Deploying: $(( ${#HEALTHY[@]} + ${#MISSING[@]} ))/${#SERVICES[@]} (timeout: $idx/$TIMEOUT)"
debug "Deploying: $(( ${#HEALTHY[@]} + ${#MISSING[@]} ))/${#SERVICES[@]} (timeout: $idx/$TIMEOUT)"
done
success "All services up! Deployment succeeded!"
}
ensure_domain_deployed() {