Update compose-check to suport compose subcommand
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
IamTheFij 2022-03-04 15:55:57 -08:00
parent 5a0378fee5
commit 71cd8ff86a

View File

@ -1,10 +1,19 @@
#! /bin/bash #! /usr/bin/env bash
# Verifies that files passed in are valid for docker-compose # Verifies that files passed in are valid for docker-compose
set -e set -e
if command -v docker-compose &> /dev/null ; then
COMPOSE=docker-compose
elif command -v docker &> /dev/null && docker help compose &> /dev/null; then
COMPOSE=docker compose
else
echo "ERROR: Neither 'docker-compose' or 'docker compose' were found"
exit 1
fi
check_file() { check_file() {
local file=$1 local file=$1
docker-compose --file "$file" config --quiet 2>&1 \ env $COMPOSE --file "$file" config --quiet 2>&1 \
| sed "/variable is not set. Defaulting/d" | sed "/variable is not set. Defaulting/d"
return "${PIPESTATUS[0]}" return "${PIPESTATUS[0]}"
} }