Make recipe .. release handle missing app service

Closes #151
This commit is contained in:
3wc 2021-04-27 19:09:39 +02:00
parent 44b378abba
commit 280238d95d

19
abra
View File

@ -2020,6 +2020,20 @@ sub_recipe_release() {
for compose_file in "${compose_files[@]}"; do for compose_file in "${compose_files[@]}"; do
mapfile -t services < <($YQ e -N '.services | keys | .[]' "$compose_file" | sort -u) mapfile -t services < <($YQ e -N '.services | keys | .[]' "$compose_file" | sort -u)
if ! printf '%s\0' "${services[@]}" | grep -Fqxz -- "app"; then
# shellcheck disable=SC2016
warning 'No `app` service found; which one should we use for the version number?'
select service_item in "${services[@]##*/}"; do
if [ 1 -le "$REPLY" ] && [ "$REPLY" -le ${#services[@]} ]; then
main_service="$service_item"
success "Selected ${service_item} as main service"
break
fi
done
else
main_service="app"
fi
for service in "${services[@]}"; do for service in "${services[@]}"; do
# 3wc: skip the "app" service unless we're in compose.yml; this service is # 3wc: skip the "app" service unless we're in compose.yml; this service is
# often repeated in other compose.*.yml files to extend options, but we only # often repeated in other compose.*.yml files to extend options, but we only
@ -2041,7 +2055,7 @@ sub_recipe_release() {
fi fi
if [ -z "$latest_version" ] || [ "$force" = "true" ] || [ "$service_tag" != "$latest_tag" ]; then if [ -z "$latest_version" ] || [ "$force" = "true" ] || [ "$service_tag" != "$latest_tag" ]; then
if [ "$service" = "app" ]; then if [ "$service" = "$main_service" ]; then
new_version="$service_tag" new_version="$service_tag"
fi fi
info "Fetching $service_image metadata from Docker Hub" info "Fetching $service_image metadata from Docker Hub"
@ -2063,8 +2077,7 @@ sub_recipe_release() {
done done
if [ "$new_version" = "false" ]; then if [ "$new_version" = "false" ]; then
# $main_service tag hasn't changed, just bump release
# `app` tag hasn't changed, just bump release
if echo "$latest_version" | grep -q '_'; then if echo "$latest_version" | grep -q '_'; then
latest_version_minor="${latest_version##*_}" latest_version_minor="${latest_version##*_}"
else else