ref: Replace regex with --short flag to get compose version (#1551)

This flag works all the way back to compose 1.4, when the version argument was introduced.
This commit is contained in:
Ethan Smith 2022-06-30 13:38:59 -07:00 committed by GitHub
parent 2672ce5452
commit e028a5ed52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,9 +12,8 @@ if [[ "$(ver $DOCKER_VERSION)" -lt "$(ver $MIN_DOCKER_VERSION)" ]]; then
fi
echo "Found Docker version $DOCKER_VERSION"
# See https://github.com/getsentry/self-hosted/issues/1132#issuecomment-982823712 ff. for regex testing.
COMPOSE_VERSION=$($dc_base version | head -n1 | sed -E 's/^.* version:? v?([0-9.]+),?.*$/\1/')
if [[ "$(ver $COMPOSE_VERSION)" -lt "$(ver $MIN_COMPOSE_VERSION)" ]]; then
COMPOSE_VERSION=$($dc_base version --short)
if [[ "$(ver ${COMPOSE_VERSION//v})" -lt "$(ver $MIN_COMPOSE_VERSION)" ]]; then
echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION"
exit 1
fi