From cca4b5f927ed005dc6f3a654507cc64c1c118271 Mon Sep 17 00:00:00 2001 From: ELADAV Date: Wed, 20 Nov 2024 13:56:01 +0200 Subject: [PATCH] added oci-layout-path opt to relativePath check --- cmd/executor/cmd/root.go | 1 + pkg/executor/push.go | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 7f0339c5d..5f25093dd 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -454,6 +454,7 @@ func resolveRelativePaths() error { &opts.DigestFile, &opts.ImageNameDigestFile, &opts.ImageNameTagDigestFile, + &opts.OCILayoutPath, } for _, p := range optsPaths { diff --git a/pkg/executor/push.go b/pkg/executor/push.go index cbe5139e9..15909b49b 100644 --- a/pkg/executor/push.go +++ b/pkg/executor/push.go @@ -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") }