diff --git a/api/tech/docker/fetcher.go b/api/tech/docker/fetcher.go index 4a2eec584e..262c9fa6ba 100644 --- a/api/tech/docker/fetcher.go +++ b/api/tech/docker/fetcher.go @@ -25,6 +25,8 @@ type dockerFetcher struct { func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.ReadCloser, error) { ctx = log.WithLogger(ctx, log.G(ctx).WithField("digest", desc.Digest)) + fmt.Println("Fetching: ", r.refspec, desc) + hosts := r.filterHosts(HostCapabilityPull) if len(hosts) == 0 { return nil, errors.Wrap(errdefs.ErrNotFound, "no pull hosts") @@ -39,7 +41,7 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R // firstly try fetch via external urls for _, us := range desc.URLs { ctx = log.WithLogger(ctx, log.G(ctx).WithField("url", us)) - + fmt.Println("us: ", r.refspec, desc, us) u, err := url.Parse(us) if err != nil { log.G(ctx).WithError(err).Debug("failed to parse") diff --git a/api/tech/regclient/client.go b/api/tech/regclient/client.go index d3721f0f9a..43963dfbd5 100644 --- a/api/tech/regclient/client.go +++ b/api/tech/regclient/client.go @@ -140,12 +140,12 @@ func (c *Client) Resolve(ctx context.Context, ref string) (string, ociv1.Descrip } // first, try to find the manifest - m, err := c.rc.ManifestGet(ctx, r) + m, err := c.rc.ManifestHead(ctx, r) if err != nil { if errors.Is(err, regerr.ErrNotFound) { // try to find a blob if r.Digest != "" { - blob, err := c.rc.BlobGet(ctx, r, descriptor.Descriptor{ + blob, err := c.rc.BlobHead(ctx, r, descriptor.Descriptor{ Digest: digest.Digest(r.Digest), }) defer blob.Close() // we can safely close it as this is not when we read it. @@ -261,7 +261,7 @@ func (c *Client) Fetch(ctx context.Context, desc ociv1.Descriptor) (_ io.ReadClo if c.isManifest(desc) { fmt.Println("in manifest: ", desc, c.ref) - manifestContent, err := c.rc.ManifestGet(ctx, c.ref) + manifestContent, err := c.rc.ManifestGet(ctx, c.ref, regclient.WithManifestDesc(c.convertDescriptorToRegClient(desc))) if err != nil { return nil, err } @@ -274,6 +274,8 @@ func (c *Client) Fetch(ctx context.Context, desc ociv1.Descriptor) (_ io.ReadClo return io.NopCloser(bytes.NewReader(body)), nil } + fmt.Println("in blob get: ", desc, c.ref) + reader, err := c.rc.BlobGet(ctx, c.ref, c.convertDescriptorToRegClient(desc)) if err != nil { return nil, fmt.Errorf("failed to get the blob reader: %w", err) diff --git a/examples/lib/tour/07-resource-management/example.go b/examples/lib/tour/07-resource-management/example.go index ccd3471e87..3734c65859 100644 --- a/examples/lib/tour/07-resource-management/example.go +++ b/examples/lib/tour/07-resource-management/example.go @@ -249,23 +249,19 @@ func GatherResources(ctx ocm.Context, factory ResourceFactory) ([]Resource, erro ) acc, err := r.Access() if err != nil { - fmt.Printf("cannot access resource 1: %s\n", err) res.SetError(err.Error()) } else { m, err := acc.AccessMethod(cv) - fmt.Printf("cannot access resource 2: %s\n", err) if err == nil { // delegate data handling to target // we don't know, how this is implemented. err = res.AddDataFromMethod(ctx, m) - fmt.Println("ERROR on 3: ", err, m) if err != nil { res.SetError(err.Error()) } // release local usage of the access method object m.Close() } else { - fmt.Printf("cannot access resource 3: %s\n", err) res.SetError(err.Error()) } }