Skip to content

Commit

Permalink
Fix upgrade for Docker Compose version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 9, 2024
1 parent 8a76bd3 commit 99eadbf
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit 99eadbf

Please sign in to comment.