From cdeaf6b1e37a0d1e2366c83c86896f98adceb1d4 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 22 Feb 2022 14:45:24 +0100 Subject: [PATCH] KIWI_ variables --- kiwi_scp/scripts/kiwi.py | 2 +- kiwi_scp/service.py | 4 ++-- tests/test_service.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kiwi_scp/scripts/kiwi.py b/kiwi_scp/scripts/kiwi.py index 6f96b5d..ac9dc9e 100644 --- a/kiwi_scp/scripts/kiwi.py +++ b/kiwi_scp/scripts/kiwi.py @@ -18,7 +18,7 @@ def main(verbose: int) -> None: - Manage full instances using just your favorite version control system - Group services into projects, each with their own docker-compose.yml - Build service-specific, private docker images from Dockerfiles - - Make use of the local file system by referring to ${TARGETDIR}, ${TARGETROOT} and ${CONFIGDIR} in compose files + - Make use of the local file system by referring to ${KIWI_PROJECT}, ${KIWI_INSTANCE} and ${KIWI_CONFIG} in compose files - Create your own instance-global variables for compose files using the kiwi.yml "environment" section """ diff --git a/kiwi_scp/service.py b/kiwi_scp/service.py index 220aa63..893f387 100644 --- a/kiwi_scp/service.py +++ b/kiwi_scp/service.py @@ -22,7 +22,7 @@ class Service: content: CommentedMap = attr.ib() parent_project: "Project" = attr.ib() - _RE_CONFIGDIR = re.compile(r"^\s*\$(?:CONFIGDIR|{CONFIGDIR})/+(.*)$", flags=re.UNICODE) + _RE_KIWI_CONFIG = re.compile(r"^\s*\$(?:KIWI_CONFIG|{KIWI_CONFIG})/+(.*)$", flags=re.UNICODE) @property def configs(self) -> Generator[Path, None, None]: @@ -31,7 +31,7 @@ class Service: for volume in self.content["volumes"]: host_part = volume.split(":")[0] - cd_match = Service._RE_CONFIGDIR.match(host_part) + cd_match = Service._RE_KIWI_CONFIG.match(host_part) if cd_match: yield Path(cd_match.group(1)) diff --git a/tests/test_service.py b/tests/test_service.py index 064edad..d172f06 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -35,8 +35,8 @@ class TestDefault: "image": "repo/image:tag", "volumes": [ "docker_volume/third/dir:/path/to/third/mountpoint", - "${TARGETDIR}/some/dir:/path/to/some/mountpoint", - "$TARGETDIR/other/dir:/path/to/other/mountpoint", + "${KIWI_PROJECT}/some/dir:/path/to/some/mountpoint", + "$KIWI_PROJECT/other/dir:/path/to/other/mountpoint", ] }), parent_project=None, @@ -51,8 +51,8 @@ class TestDefault: content=CommentedMap({ "image": "repo/image:tag", "volumes": [ - "${CONFIGDIR}/some/config:/path/to/some/config", - "$CONFIGDIR/other/config:/path/to/other/config", + "${KIWI_CONFIG}/some/config:/path/to/some/config", + "$KIWI_CONFIG/other/config:/path/to/other/config", ] }), parent_project=None,