Skip to content

Commit

Permalink
Add more descriptive error on manifest list push
Browse files Browse the repository at this point in the history
Adds a more descriptive error message for pushing indexes/manifest list
references with missing content references to a docker v2 API supporting
container registry. This can be followed up with a more complete review
of how to handle "deep" references for manifest lists on push/pull post
containerd 1.0.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
  • Loading branch information
estesp committed Dec 4, 2017
1 parent cc969fb commit 02661c7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client.go
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"runtime"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -334,6 +335,14 @@ func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor,
for i := len(manifestStack) - 1; i >= 0; i-- {
_, err := pushHandler(ctx, manifestStack[i])
if err != nil {
// TODO(estesp): until we have a more complete method for index push, we need to report
// missing dependencies in an index/manifest list by sensing the "400 Bad Request"
// as a marker for this problem
if (manifestStack[i].MediaType == ocispec.MediaTypeImageIndex ||
manifestStack[i].MediaType == images.MediaTypeDockerSchema2ManifestList) &&
errors.Cause(err) != nil && strings.Contains(errors.Cause(err).Error(), "400 Bad Request") {
return errors.Wrap(err, "manifest list/index references to blobs and/or manifests are missing in your target registry")
}
return err
}
}
Expand Down

0 comments on commit 02661c7

Please sign in to comment.