From 6fc19c402474be2d282bcf1d467db504b56dc3d2 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:06:30 +0200 Subject: [PATCH] build: set same ref when building on multiple nodes Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- build/build.go | 4 ++++ build/opt.go | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/build.go b/build/build.go index d7a1e8345f0..34a895d4c35 100644 --- a/build/build.go +++ b/build/build.go @@ -32,6 +32,7 @@ import ( "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" gateway "github.com/moby/buildkit/frontend/gateway/client" + "github.com/moby/buildkit/identity" "github.com/moby/buildkit/session" "github.com/moby/buildkit/solver/errdefs" "github.com/moby/buildkit/solver/pb" @@ -216,6 +217,9 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s if err != nil { logrus.WithError(err).Warn("current commit information was not captured by the build") } + if opt.Ref == "" { + opt.Ref = identity.NewID() + } var reqn []*reqForNode for _, np := range drivers[k] { if np.Node().Driver.IsMobyDriver() { diff --git a/build/opt.go b/build/opt.go index d8a1ba027a3..0d6dfbeff3e 100644 --- a/build/opt.go +++ b/build/opt.go @@ -104,10 +104,6 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op SourcePolicy: opt.SourcePolicy, } - if so.Ref == "" { - so.Ref = identity.NewID() - } - if opt.CgroupParent != "" { so.FrontendAttrs["cgroup-parent"] = opt.CgroupParent }