added first commit for path fix

This commit is contained in:
ELADAV 2024-11-19 15:19:30 +02:00
parent e328007bc1
commit 820f4575f1
1 changed files with 13 additions and 2 deletions

View File

@ -196,7 +196,17 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
}
if opts.OCILayoutPath != "" {
path, err := layout.Write(opts.OCILayoutPath, empty.Index)
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)
if err != nil {
return errors.Wrap(err, "writing empty layout")
}
@ -204,7 +214,8 @@ func DoPush(image v1.Image, opts *config.KanikoOptions) error {
return errors.Wrap(err, "appending image")
}
}
if opts.NoPush && len(opts.Destinations) == 0 {
if opts.TarPath != "" {
setDummyDestinations(opts)