WIP version output summary which handles services
continuous-integration/drone/push Build is passing Details

See coop-cloud/organising#47.
This commit is contained in:
decentral1se 2021-03-15 18:30:37 +01:00
parent 0d98c442a2
commit e99bedf9e4
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 25 additions and 0 deletions

25
abra
View File

@ -461,6 +461,29 @@ load_abra_sh() {
fi
}
output_version_summary() {
echo " Versions:"
IFS=':' read -ra COMPOSE_FILES <<< "$COMPOSE_FILE"
for COMPOSE in "${COMPOSE_FILES[@]}"; do
SERVICES=$(yq e '.services | keys | .[]' "${APP_DIR}/${COMPOSE_FILE}")
for SERVICE in $SERVICES; do
filter="{{index .Spec.Labels \"coop-cloud.gitea.$SERVICE.version\" }}"
label=$(docker service inspect -f "$filter" "gitea_$SERVICE" 2>/dev/null)
live_version=$(echo "$label" | cut -d- -f1)
live_digest=$(echo "$label" | cut -d- -f2)
if [ -n "$live_version" ] && [ -n "$live_digest" ]; then
echo " ${STACK_NAME}_${SERVICE}:"
echo " deployed: $(tput setaf 2)$live_version ($live_digest)$(tput sgr0)"
app_version_lookup="ABRA_TYPE_${SERVICE^^}_VERSION"
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)"
fi
done
done
}
###### FIXME 3wc: name this section
get_servers() {
@ -933,6 +956,8 @@ sub_app_deploy (){
echo " Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
output_version_summary
prompt_confirm
APP=$(basename "$APP_DIR")