MCPcopy
hub / github.com/containerd/containerd / WithScope

Function WithScope

core/remotes/docker/scope.go:58–67  ·  view source on GitHub ↗

WithScope appends a custom registry auth scope to the context.

(ctx context.Context, scope string)

Source from the content-addressed store, hash-verified

56
57// WithScope appends a custom registry auth scope to the context.
58func WithScope(ctx context.Context, scope string) context.Context {
59 var scopes []string
60 if v := ctx.Value(tokenScopesKey{}); v != nil {
61 scopes = v.([]string)
62 scopes = append(scopes, scope)
63 } else {
64 scopes = []string{scope}
65 }
66 return context.WithValue(ctx, tokenScopesKey{}, scopes)
67}
68
69// ContextWithAppendPullRepositoryScope is used to append repository pull
70// scope into existing scopes indexed by the tokenScopesKey{}.

Callers 3

TestCustomScopeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestCustomScopeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…