Skip to content

Commit f31f493

Browse files
committed
Push the injected image if exist, otherwise push the source image.
Ensures image loading succeeds by trying an alternative path if the initial one is unavailable
1 parent 6f06eda commit f31f493

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/build/kaniko.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,12 @@ func (bb *Build) pullDaemonless(tag string) error {
258258
func (bb *Build) tagAndPushDaemonless(from, to string) error {
259259
bb.Printf("Running: tag and push %s\n", to)
260260

261-
imgTar := tarPathFor(from)
261+
imgTar := injectedTarPathFor(from)
262262
img, err := tarball.ImageFromPath(imgTar, nil)
263+
if err != nil && os.IsNotExist(err) {
264+
imgTar = tarPathFor(from)
265+
img, err = tarball.ImageFromPath(imgTar, nil)
266+
}
263267
if err != nil {
264268
return fmt.Errorf("load tar: %w", err)
265269
}

0 commit comments

Comments
 (0)