Also exit with status 2 for missing tags in oci-archive:

No tests because we aren't testing oci-archive: anywhere
else either.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2025-05-28 22:30:23 +02:00
parent 634c0d99f3
commit 99c6fb09e9

View File

@ -13,6 +13,7 @@ import (
"github.com/containers/common/pkg/retry"
"github.com/containers/image/v5/directory"
"github.com/containers/image/v5/manifest"
ociarchive "github.com/containers/image/v5/oci/archive"
ocilayout "github.com/containers/image/v5/oci/layout"
"github.com/containers/image/v5/pkg/compression"
"github.com/containers/image/v5/storage"
@ -420,9 +421,11 @@ func promptForPassphrase(privateKeyFile string, stdin, stdout *os.File) (string,
// TODO drive this into containers/image properly
func isNotFoundImageError(err error) bool {
var layoutImageNotFoundError ocilayout.ImageNotFoundError
var archiveImageNotFoundError ociarchive.ImageNotFoundError
return isDockerManifestUnknownError(err) ||
errors.Is(err, storage.ErrNoSuchImage) ||
errors.As(err, &layoutImageNotFoundError)
errors.As(err, &layoutImageNotFoundError) ||
errors.As(err, &archiveImageNotFoundError)
}
// isDockerManifestUnknownError is a copy of code from containers/image,