From f7922fbf57ac7d479cb4207294448c2d37ecf700 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 19 Jul 2022 10:12:33 +0100 Subject: [PATCH] exporter: add unique exporter identifiers in progress output This patch ensures that all progress outputs for exporters are properly keyed uniquely to the session, to ensure that duplicate exporters across different sessions do not conflict and produce confusing results. Currently, this behavior isn't relied upon by buildkit, but is used by buildx bake, where multiple image exporters might be invoked at the same time. Signed-off-by: Justin Chadwell --- solver/llbsolver/solver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solver/llbsolver/solver.go b/solver/llbsolver/solver.go index 19c79ee1d5dd..773e97c29562 100644 --- a/solver/llbsolver/solver.go +++ b/solver/llbsolver/solver.go @@ -242,7 +242,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro inp.Refs = m } if _, ok := asInlineCache(exp.CacheExporter); ok { - if err := inBuilderContext(ctx, j, "preparing layers for inline cache", "", func(ctx context.Context, _ session.Group) error { + if err := inBuilderContext(ctx, j, "preparing layers for inline cache", j.SessionID+"-cache-inline", func(ctx context.Context, _ session.Group) error { if cr != nil { dtic, err := inlineCache(ctx, exp.CacheExporter, cr, e.Config().Compression, session.NewGroup(sessionID)) if err != nil { @@ -267,7 +267,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro return nil, err } } - if err := inBuilderContext(ctx, j, e.Name(), "", func(ctx context.Context, _ session.Group) error { + if err := inBuilderContext(ctx, j, e.Name(), j.SessionID+"-export", func(ctx context.Context, _ session.Group) error { exporterResponse, err = e.Export(ctx, inp, j.SessionID) return err }); err != nil { @@ -278,7 +278,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro g := session.NewGroup(j.SessionID) var cacheExporterResponse map[string]string if e := exp.CacheExporter; e != nil { - if err := inBuilderContext(ctx, j, "exporting cache", "", func(ctx context.Context, _ session.Group) error { + if err := inBuilderContext(ctx, j, "exporting cache", j.SessionID+"-cache", func(ctx context.Context, _ session.Group) error { prepareDone := oneOffProgress(ctx, "preparing build cache for export") if err := res.EachRef(func(res solver.ResultProxy) error { r, err := res.Result(ctx)