[#784] framework fix: cn_count double-count (grep -c prints 0 + || echo 0 appended second line)
ci / audit (push) Successful in 26s
ci / audit (push) Successful in 26s
https://projects.knownelement.com/issues/784
This commit is contained in:
@@ -87,7 +87,7 @@ if [ -n "$COMPOSE_FILES" ]; then
|
|||||||
# Count top-level service keys (2-space indent under services:) and
|
# Count top-level service keys (2-space indent under services:) and
|
||||||
# compare against the number of container_name: declarations.
|
# compare against the number of container_name: declarations.
|
||||||
svc_count=$(awk '/^services:/{f=1;next} f&&/^[^[:space:]]/{f=0} f&&/^[[:space:]]{2}[[:alnum:]_-]+:[[:space:]]*$/{c++} END{print c+0}' "$cf")
|
svc_count=$(awk '/^services:/{f=1;next} f&&/^[^[:space:]]/{f=0} f&&/^[[:space:]]{2}[[:alnum:]_-]+:[[:space:]]*$/{c++} END{print c+0}' "$cf")
|
||||||
cn_count=$(grep -cE '^[[:space:]]*container_name:' "$cf" 2>/dev/null || echo 0)
|
cn_count=$(grep -cE '^[[:space:]]*container_name:' "$cf" 2>/dev/null)
|
||||||
if [ "${svc_count:-0}" -gt 0 ] && [ "$cn_count" -lt "$svc_count" ]; then
|
if [ "${svc_count:-0}" -gt 0 ] && [ "$cn_count" -lt "$svc_count" ]; then
|
||||||
BAD=$((BAD + 1))
|
BAD=$((BAD + 1))
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user