Fix 404 handling when deleting a manifest (#850)

Upstream was previously using an internal notFound error, and we were
relying on fragile string matching to detect it. This broke when we
upgraded to Docker v28.

d25e260d2e (diff-a5e122cd2318f2dc156f373804a59d30355b0c308b9e64f48e0713344fcdba33L164)

Nowadays containerd exposes a public ErrNotFound which we can use
instead.

Fixes #849.
This commit is contained in:
Bryce Lampe
2026-05-12 10:46:54 -07:00
committed by GitHub
parent 9048892848
commit df2dcca9a8
5 changed files with 42 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ import (
"os"
"strings"
"github.com/containerd/errdefs"
"github.com/distribution/reference"
buildx "github.com/docker/buildx/build"
"github.com/docker/buildx/builder"
@@ -339,6 +340,9 @@ func (c *cli) ManifestInspect(ctx context.Context, target string) (string, error
}
m, err := rc.ManifestHead(ctx, ref)
if errors.Is(err, errs.ErrNotFound) {
return "", fmt.Errorf("fetching %q: %w", ref, errdefs.ErrNotFound)
}
if err != nil {
return "", fmt.Errorf("fetching %q: %w", ref, err)
}
@@ -359,6 +363,9 @@ func (c *cli) ManifestDelete(ctx context.Context, target string) error {
provider.GetLogger(ctx).Warning("this registry does not support deletions")
return nil
}
if errors.Is(err, errs.ErrNotFound) {
return nil
}
if err != nil {
return err
}