Skip to content

Commit a205add

Browse files
handle weird docker-compose versions
arch is installing a docker compose binary that returns its version as `dev` for some reason
1 parent 628a369 commit a205add

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

misc/python/materialize/cli/mzcompose.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,20 @@ def load_composition(args: argparse.Namespace) -> Composition:
176176
hint="If you believe this is a mistake, contact the QA team. While not recommended, --ignore-docker-version can be used to ignore this version check.",
177177
)
178178

179-
compose_local_version = Version.parse(
180-
spawn.capture(["docker", "compose", "version", "--short"])
179+
compose_local_version_s = spawn.capture(
180+
["docker", "compose", "version", "--short"]
181181
)
182-
compose_ci_version = Version.parse("2.15.1")
183-
if compose_local_version < compose_ci_version:
184-
raise UIError(
185-
f"Your Docker Compose version is {compose_local_version} while the version used in CI is {compose_ci_version}, please upgrade your local Docker Compose version to prevent unexpected breakages.",
186-
hint="If you believe this is a mistake, contact the QA team. While not recommended, --ignore-docker-version can be used to ignore this version check.",
187-
)
188-
sys.exit(1)
182+
try:
183+
compose_local_version = Version.parse(compose_local_version_s)
184+
compose_ci_version = Version.parse("2.15.1")
185+
if compose_local_version < compose_ci_version:
186+
raise UIError(
187+
f"Your Docker Compose version is {compose_local_version} while the version used in CI is {compose_ci_version}, please upgrade your local Docker Compose version to prevent unexpected breakages.",
188+
hint="If you believe this is a mistake, contact the QA team. While not recommended, --ignore-docker-version can be used to ignore this version check.",
189+
)
190+
sys.exit(1)
191+
except ValueError:
192+
pass
189193

190194
repo = mzbuild.Repository.from_arguments(MZ_ROOT, args)
191195
try:

0 commit comments

Comments
 (0)