KIWI_ variables

This commit is contained in:
Jörn-Michael Miehe 2022-02-22 14:45:24 +01:00
parent 66a3f25b93
commit cdeaf6b1e3
3 changed files with 7 additions and 7 deletions

View file

@ -18,7 +18,7 @@ def main(verbose: int) -> None:
- Manage full instances using just your favorite version control system - Manage full instances using just your favorite version control system
- Group services into projects, each with their own docker-compose.yml - Group services into projects, each with their own docker-compose.yml
- Build service-specific, private docker images from Dockerfiles - 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 - Create your own instance-global variables for compose files using the kiwi.yml "environment" section
""" """

View file

@ -22,7 +22,7 @@ class Service:
content: CommentedMap = attr.ib() content: CommentedMap = attr.ib()
parent_project: "Project" = 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 @property
def configs(self) -> Generator[Path, None, None]: def configs(self) -> Generator[Path, None, None]:
@ -31,7 +31,7 @@ class Service:
for volume in self.content["volumes"]: for volume in self.content["volumes"]:
host_part = volume.split(":")[0] 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: if cd_match:
yield Path(cd_match.group(1)) yield Path(cd_match.group(1))

View file

@ -35,8 +35,8 @@ class TestDefault:
"image": "repo/image:tag", "image": "repo/image:tag",
"volumes": [ "volumes": [
"docker_volume/third/dir:/path/to/third/mountpoint", "docker_volume/third/dir:/path/to/third/mountpoint",
"${TARGETDIR}/some/dir:/path/to/some/mountpoint", "${KIWI_PROJECT}/some/dir:/path/to/some/mountpoint",
"$TARGETDIR/other/dir:/path/to/other/mountpoint", "$KIWI_PROJECT/other/dir:/path/to/other/mountpoint",
] ]
}), }),
parent_project=None, parent_project=None,
@ -51,8 +51,8 @@ class TestDefault:
content=CommentedMap({ content=CommentedMap({
"image": "repo/image:tag", "image": "repo/image:tag",
"volumes": [ "volumes": [
"${CONFIGDIR}/some/config:/path/to/some/config", "${KIWI_CONFIG}/some/config:/path/to/some/config",
"$CONFIGDIR/other/config:/path/to/other/config", "$KIWI_CONFIG/other/config:/path/to/other/config",
] ]
}), }),
parent_project=None, parent_project=None,