diff --git a/scripts/upgrade b/scripts/upgrade index d2d8fb0275..a130ec4db4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 @@ -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": @@ -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",