From 88d158cbf1df8581d0d23f6aa783b50db1f9858d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marques?= Date: Thu, 21 Oct 2021 12:27:01 +0100 Subject: [PATCH] Enable usage of git-autoshare Needs https://github.com/Tecnativa/doodba/pull/453 Enables git-autoshare process for the local aggregation process Sets up local cache even if user doesn't have git-autoshare installed and setup locally. TT32042 --- setup-devel.yaml.jinja | 3 +++ tasks_downstream.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/setup-devel.yaml.jinja b/setup-devel.yaml.jinja index f5a16bd6..cce606e5 100644 --- a/setup-devel.yaml.jinja +++ b/setup-devel.yaml.jinja @@ -27,16 +27,19 @@ services: COMPILE: "false" UID: "${UID:-1000}" GID: "${GID:-1000}" + GIT_AUTOSHARE: "1" networks: - public volumes: - ./odoo/custom/src:/opt/odoo/custom/src:rw,z + - ~/.cache/git-autoshare/:/home/odoo/.cache/git-autoshare/:rw,z environment: DEPTH_DEFAULT: 100 # XXX Export these variables before running setup to own the files UID: "${UID:-1000}" GID: "${GID:-1000}" UMASK: "$UMASK" + GIT_AUTOSHARE: "1" user: root entrypoint: autoaggregate diff --git a/tasks_downstream.py b/tasks_downstream.py index 173b10ce..050e66e1 100644 --- a/tasks_downstream.py +++ b/tasks_downstream.py @@ -15,6 +15,7 @@ from pathlib import Path from shutil import which +import appdirs from invoke import exceptions, task from invoke.util import yaml @@ -403,6 +404,11 @@ def git_aggregate(c): Executes git-aggregator from within the doodba container. """ + # Create git-autoshare cache folder if it doesn't exist + git_autoshare_cache_dir = os.environ.get( + "GIT_AUTOSHARE_CACHE_DIR" + ) or appdirs.user_cache_dir("git-autoshare") + Path(git_autoshare_cache_dir).mkdir(exist_ok=True) with c.cd(str(PROJECT_ROOT)): c.run( "docker-compose --file setup-devel.yaml run --rm odoo",