Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions util/imagetools/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"net/url"
"strings"
"sync"

"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
Expand All @@ -26,6 +27,7 @@ import (
type Source struct {
Desc ocispec.Descriptor
Ref reference.Named
mu sync.Mutex
}

func (r *Resolver) Combine(ctx context.Context, srcs []*Source, ann []string) ([]byte, ocispec.Descriptor, error) {
Expand Down Expand Up @@ -231,10 +233,12 @@ func (r *Resolver) Copy(ctx context.Context, src *Source, dest reference.Named)
return err
}
source, repo := u.Hostname(), strings.TrimPrefix(u.Path, "/")
src.mu.Lock()
if src.Desc.Annotations == nil {
src.Desc.Annotations = make(map[string]string)
}
src.Desc.Annotations["containerd.io/distribution.source."+source] = repo
src.mu.Unlock()

err = contentutil.CopyChain(ctx, contentutil.FromPusher(p), contentutil.FromFetcher(f), src.Desc)
if err != nil {
Expand Down