Quadlet build - consider File path that starts with a systemd specifier as absolute

Fixes https://github.com/containers/podman/issues/26746

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
Ygal Blum
2025-09-09 10:25:17 -04:00
parent 8900d8e77b
commit 936a01e088
3 changed files with 5 additions and 1 deletions

View File

@@ -1428,7 +1428,7 @@ func ConvertBuild(build *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isU
// Context or WorkingDirectory has to be last argument
if len(context) > 0 {
podman.add(context)
} else if !filepath.IsAbs(filePath) && !isURL(filePath) {
} else if !startsWithSystemdSpecifier(filePath) && !filepath.IsAbs(filePath) && !isURL(filePath) {
// Special handling for relative filePaths
if len(workingDirectory) == 0 {
return nil, warnings, fmt.Errorf("relative path in File key requires SetWorkingDirectory key to be set")

View File

@@ -0,0 +1,3 @@
[Build]
ImageTag=localhost/example
File=%h/images/example.Containerfile

View File

@@ -1074,6 +1074,7 @@ BOGUS=foo
Entry("Build - Variant Key", "variant.build"),
Entry("Build - No Default Dependencies", "no_deps.build"),
Entry("Build - Retry", "retry.build"),
Entry("Build - No WorkingDirectory with systemd specifier", "no-workingdirectory-systemd-specifier.build"),
Entry("Pod - Basic", "basic.pod"),
Entry("Pod - DNS", "dns.pod"),