added oci-layout-path opt to relativePath check

This commit is contained in:
Elad Avikzer 2024-11-20 13:56:01 +02:00 committed by ELADAV
parent 820f4575f1
commit efa7da69bd
2 changed files with 2 additions and 11 deletions

View File

@ -454,6 +454,7 @@ func resolveRelativePaths() error {
&opts.DigestFile,
&opts.ImageNameDigestFile,
&opts.ImageNameTagDigestFile,
&opts.OCILayoutPath,
}
for _, p := range optsPaths {

View File

@ -196,17 +196,7 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
}
if opts.OCILayoutPath != "" {
resolvedPath := opts.OCILayoutPath
if !filepath.IsAbs(resolvedPath) {
// If the path is relative, make it absolute
cwd, err := os.Getwd()
if err != nil {
return errors.Wrap(err, "getting current working directory")
}
resolvedPath = filepath.Join(cwd, resolvedPath)
}
path, err := layout.Write(resolvedPath, empty.Index)
path, err := layout.Write(opts.OCILayoutPath, empty.Index)
if err != nil {
return errors.Wrap(err, "writing empty layout")
}