From c47f2a4a1a7bf664b853bc4d3c8d1022c59ba332 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 7 May 2019 10:33:04 -0700 Subject: [PATCH] builder-next: fix gcr workaround token cache Signed-off-by: Tonis Tiigi (cherry picked from commit cfce0acd332d7536f85356f99b99a920be6cda87) Signed-off-by: Sebastiaan van Stijn --- builder/builder-next/adapters/containerimage/pull.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/builder-next/adapters/containerimage/pull.go b/builder/builder-next/adapters/containerimage/pull.go index 406bcd9cc7..dd9f5cf870 100644 --- a/builder/builder-next/adapters/containerimage/pull.go +++ b/builder/builder-next/adapters/containerimage/pull.go @@ -842,7 +842,7 @@ func (r *resolverCache) Add(ctx context.Context, ref string, resolver remotes.Re r.mu.Lock() defer r.mu.Unlock() - ref = r.domain(ref) + "-" + session.FromContext(ctx) + ref = r.repo(ref) + "-" + session.FromContext(ctx) cr, ok := r.m[ref] cr.timeout = time.Now().Add(time.Minute) @@ -855,19 +855,19 @@ func (r *resolverCache) Add(ctx context.Context, ref string, resolver remotes.Re return &cr } -func (r *resolverCache) domain(refStr string) string { +func (r *resolverCache) repo(refStr string) string { ref, err := distreference.ParseNormalizedNamed(refStr) if err != nil { return refStr } - return distreference.Domain(ref) + return ref.Name() } func (r *resolverCache) Get(ctx context.Context, ref string) remotes.Resolver { r.mu.Lock() defer r.mu.Unlock() - ref = r.domain(ref) + "-" + session.FromContext(ctx) + ref = r.repo(ref) + "-" + session.FromContext(ctx) cr, ok := r.m[ref] if !ok {