Bad YAML = showstopper

Fixes #154
This commit is contained in:
3wc 2021-05-30 00:18:24 +02:00
parent 8a4f82ba84
commit a4f3fc5ce2
2 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,7 @@
- Fix secret length generation ([f537417](https://git.autonomic.zone/coop-cloud/abra/commit/1b85bf3d37280e9632c315d759c0f2d09c039fef))
- Fix checking out new apps ([#164](https://git.autonomic.zone/coop-cloud/abra/issues/164)
- Give up if YAML is invalid ([#154](https://git.autonomic.zone/coop-cloud/abra/issues/154))
# abra 0.7.4 (2021-05-10)

11
abra
View File

@ -478,6 +478,16 @@ require_docker_version() {
done
}
require_valid_json() {
require_jq
$JQ "$1" > /dev/null || error "Invalid JSON '$1'"
}
require_valid_yaml() {
require_yq
$YQ e "$1" > /dev/null || error "Invalid YAML '$1'"
}
###### Download and update data
require_apps_json() {
@ -702,6 +712,7 @@ output_version_summary() {
IFS=':' read -ra COMPOSE_FILES <<< "$COMPOSE_FILE"
for COMPOSE in "${COMPOSE_FILES[@]}"; do
require_valid_yaml "$APP_DIR/$COMPOSE"
SERVICES=$($YQ e '.services | keys | .[]' "${APP_DIR}/${COMPOSE}")
for SERVICE in $SERVICES; do