Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed top-level `name` attribute interpolation not happening.
1 change: 1 addition & 0 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,6 +2437,7 @@ def _parse_compose_file(self) -> None:
project_name = content.get("name")
if not project_name:
project_name = dir_basename.lower()
project_name = rec_subs(project_name, self.environ)
# More strict then actually needed for simplicity:
# podman requires [a-zA-Z0-9][a-zA-Z0-9_.-]*
project_name_normalized = norm_re.sub("", project_name)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/env_tests/container-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3"

name: my-project-name
name: my-project-name${ZZVAR1:-}

services:
env-test:
Expand Down
20 changes: 20 additions & 0 deletions tests/integration/env_tests/test_podman_compose_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,23 @@ def test_project_name_override(self) -> None:
compose_yaml_path(),
"down",
])

def test_project_name_interpolation(self) -> None:
try:
output, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_yaml_path(),
"run",
"-e",
"ZZVAR1=-myval2",
"project-name-test",
])
self.assertIn("my-project-name-myval2", str(output))
finally:
self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_yaml_path(),
"down",
])
Loading