Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest): handle docker-compose version v prefix #6561

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,15 @@ def get_long_description():
| bigquery_common
| {"sqlalchemy-bigquery>=1.4.1", "sqllineage==1.3.6", "sqlparse"},
"bigquery-usage-legacy": bigquery_common | usage_common | {"cachetools"},
"bigquery": sql_common | bigquery_common | {"sqllineage==1.3.6", "sql_metadata", "sqlalchemy-bigquery>=1.4.1"},
"bigquery": sql_common
| bigquery_common
| {"sqllineage==1.3.6", "sql_metadata", "sqlalchemy-bigquery>=1.4.1"},
"bigquery-beta": sql_common
| bigquery_common
| {
"sqllineage==1.3.6",
"sql_metadata",
"sqlalchemy-bigquery>=1.4.1"
"sqlalchemy-bigquery>=1.4.1",
}, # deprecated, but keeping the extra for backwards compatibility
"clickhouse": sql_common | clickhouse_common,
"clickhouse-usage": sql_common | usage_common | clickhouse_common,
Expand Down
19 changes: 8 additions & 11 deletions metadata-ingestion/src/datahub/cli/docker_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,27 +226,24 @@ def _get_default_quickstart_compose_file() -> Optional[str]:
def _docker_compose_v2() -> Union[List[str], Literal[False]]:
try:
# Check for the docker compose v2 plugin.
assert (
subprocess.check_output(
["docker", "compose", "version", "--short"], stderr=subprocess.STDOUT
)
.decode()
.startswith("2.")
)
compose_version = subprocess.check_output(
["docker", "compose", "version", "--short"], stderr=subprocess.STDOUT
).decode()
assert compose_version.startswith("2.") or compose_version.startswith("v2.")
return ["docker", "compose"]
except (OSError, subprocess.CalledProcessError, AssertionError):
# We'll check for docker-compose as well.
try:
compose_version = subprocess.check_output(
["docker-compose", "version", "--short"], stderr=subprocess.STDOUT
).decode()
if compose_version.startswith("2."):
if compose_version.startswith("2.") or compose_version.startswith("v2."):
# This will happen if docker compose v2 is installed in standalone mode
# instead of as a plugin.
return ["docker-compose"]

click.secho(
"You have docker-compose v1 installed, but we require Docker Compose v2. "
f"You have docker-compose v1 ({compose_version}) installed, but we require Docker Compose v2. "
"Please upgrade to Docker Compose v2. "
"See https://docs.docker.com/compose/compose-v2/ for more information.",
fg="red",
Expand Down Expand Up @@ -274,7 +271,7 @@ def _attempt_stop(quickstart_compose_file: List[pathlib.Path]) -> None:
# docker-compose stop
compose = _docker_compose_v2()
if not compose:
return
sys.exit(1)
base_command: List[str] = [
*compose,
*itertools.chain.from_iterable(
Expand Down Expand Up @@ -739,7 +736,7 @@ def quickstart(

compose = _docker_compose_v2()
if not compose:
return
sys.exit(1)
base_command: List[str] = [
*compose,
*itertools.chain.from_iterable(
Expand Down