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

[Backport 2.7] Fix upgrade for Docker Compose version 2 #11298

Merged
merged 1 commit into from
Aug 9, 2024
Merged
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
14 changes: 9 additions & 5 deletions scripts/upgrade
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (c) 2019-2020, Camptocamp SA
# Copyright (c) 2019-2024, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -44,6 +44,9 @@ parser.add_argument("step", nargs="?", help="the step to run")
parser_finalize = argparse.ArgumentParser(description="Upgrade the project", add_help=False)
parser_finalize.add_argument("--finalize", action="store_true", help="finalize the upgrade")
parser_finalize.add_argument("--help", action="help", help="show this help message and exit")
parser_finalize.add_argument(
"--docker-compose-version-2", action="store_true", help="Use Docker Compose version 2"
)
parser_finalize.add_argument("build_arg", nargs="*", help="build arguments")

if len(sys.argv) >= 2 and sys.argv[1] == "--finalize":
Expand All @@ -56,14 +59,15 @@ if len(sys.argv) >= 2 and sys.argv[1] == "--finalize":
if code != 0:
sys.exit(code)

subprocess.call(["docker-compose", "down", "--remove-orphans"])
docker_compose = ["docker", "compose"] if args.docker_compose_version_2 else ["docker-compose"]
subprocess.call([*docker_compose, "down", "--remove-orphans"])
subprocess.call(
["docker-compose", "pull", "--ignore-pull-failures"], env={**os.environ, "DOCKER_TAG": "unexisting"}
[*docker_compose, "pull", "--ignore-pull-failures"], env={**os.environ, "DOCKER_TAG": "unexisting"}
)
subprocess.check_call(["docker-compose", "up", "-d"])
subprocess.check_call([*docker_compose, "up", "-d"])
subprocess.check_call(
[
"docker-compose",
*docker_compose,
"exec",
"geoportal",
"alembic",
Expand Down
Loading