diff --git a/client/client_test.go b/client/client_test.go index 2e449cf705f4..58ed3cea8804 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -7086,8 +7086,9 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) { if err != nil { return nil, err } - res.AddAttestation(pk, result.Attestation{ + res.AddAttestation(pk, gateway.Attestation{ Kind: gatewaypb.AttestationKindInToto, + Ref: refAttest, Path: "/attestation.json", InToto: result.InTotoAttestation{ PredicateType: "https://example.com/attestations/v1.0", @@ -7095,9 +7096,10 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) { Kind: gatewaypb.InTotoSubjectKindSelf, }}, }, - }, refAttest) - res.AddAttestation(pk, result.Attestation{ + }) + res.AddAttestation(pk, gateway.Attestation{ Kind: gatewaypb.AttestationKindInToto, + Ref: refAttest, Path: "/attestation2.json", InToto: result.InTotoAttestation{ PredicateType: "https://example.com/attestations2/v1.0", @@ -7107,7 +7109,7 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) { Digest: []digest.Digest{successDigest}, }}, }, - }, refAttest) + }) } dt, err := json.Marshal(expPlatforms) @@ -7400,13 +7402,14 @@ func testAttestationDefaultSubject(t *testing.T, sb integration.Sandbox) { if err != nil { return nil, err } - res.AddAttestation(pk, result.Attestation{ + res.AddAttestation(pk, gateway.Attestation{ Kind: gatewaypb.AttestationKindInToto, + Ref: refAttest, Path: "/attestation.json", InToto: result.InTotoAttestation{ PredicateType: "https://example.com/attestations/v1.0", }, - }, refAttest) + }) } dt, err := json.Marshal(expPlatforms) @@ -7553,10 +7556,11 @@ func testAttestationBundle(t *testing.T, sb integration.Sandbox) { if err != nil { return nil, err } - res.AddAttestation(pk, result.Attestation{ + res.AddAttestation(pk, gateway.Attestation{ Kind: gatewaypb.AttestationKindBundle, + Ref: refAttest, Path: "/bundle", - }, refAttest) + }) } dt, err := json.Marshal(expPlatforms) @@ -7755,13 +7759,14 @@ EOF return nil, err } - res.AddAttestation(pk, result.Attestation{ + res.AddAttestation(pk, gateway.Attestation{ Kind: gatewaypb.AttestationKindInToto, + Ref: refAttest, Path: "/result.spdx", InToto: result.InTotoAttestation{ PredicateType: intoto.PredicateSPDX, }, - }, refAttest) + }) } return res, nil @@ -8005,6 +8010,15 @@ EOF } res.AddMeta(exptypes.ExporterImageConfigKey, config) + expPlatforms := &exptypes.Platforms{ + Platforms: []exptypes.Platform{{ID: pk, Platform: p}}, + } + dt, err := json.Marshal(expPlatforms) + if err != nil { + return nil, err + } + res.AddMeta(exptypes.ExporterPlatformsKey, dt) + return res, nil } diff --git a/control/control.go b/control/control.go index c250cd9cc252..eb53827e9ac3 100644 --- a/control/control.go +++ b/control/control.go @@ -17,7 +17,6 @@ import ( controlgateway "github.com/moby/buildkit/control/gateway" "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/util/epoch" - "github.com/moby/buildkit/exporter/util/multiplatform" "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/frontend/attestations" "github.com/moby/buildkit/session" @@ -305,16 +304,6 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (* } } - // if multi-platform is set, enable it for the exporter - if v, ok := multiplatform.ParseBuildArgs(req.FrontendAttrs); ok { - if _, ok := req.ExporterAttrs[multiplatform.KeyMultiPlatform]; !ok { - if req.ExporterAttrs == nil { - req.ExporterAttrs = make(map[string]string) - } - req.ExporterAttrs[multiplatform.KeyMultiPlatform] = v - } - } - if req.Exporter != "" { exp, err := w.Exporter(req.Exporter, c.opt.SessionManager) if err != nil { @@ -369,10 +358,6 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (* var procs []llbsolver.Processor - if len(attests) > 0 { - procs = append(procs, proc.ForceRefsProcessor) - } - if attrs, ok := attests["sbom"]; ok { src := attrs["generator"] if src == "" { diff --git a/exporter/attestation/filter.go b/exporter/attestation/filter.go index edd80bae28d3..5abc234b875e 100644 --- a/exporter/attestation/filter.go +++ b/exporter/attestation/filter.go @@ -3,15 +3,15 @@ package attestation import ( "bytes" - "github.com/moby/buildkit/solver/result" + "github.com/moby/buildkit/exporter" ) -func Filter(attestations []result.Attestation, include map[string][]byte, exclude map[string][]byte) []result.Attestation { +func Filter(attestations []exporter.Attestation, include map[string][]byte, exclude map[string][]byte) []exporter.Attestation { if len(include) == 0 && len(exclude) == 0 { return attestations } - result := []result.Attestation{} + result := []exporter.Attestation{} for _, att := range attestations { meta := att.Metadata if meta == nil { diff --git a/exporter/attestation/make.go b/exporter/attestation/make.go index 163fe72c3b33..8ed910c1e8d3 100644 --- a/exporter/attestation/make.go +++ b/exporter/attestation/make.go @@ -7,7 +7,7 @@ import ( "github.com/containerd/continuity/fs" intoto "github.com/in-toto/in-toto-golang/in_toto" - "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/exporter" gatewaypb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/session" "github.com/moby/buildkit/snapshot" @@ -17,7 +17,7 @@ import ( ) // ReadAll reads the content of an attestation. -func ReadAll(ctx context.Context, s session.Group, refs map[string]cache.ImmutableRef, att result.Attestation) ([]byte, error) { +func ReadAll(ctx context.Context, s session.Group, att exporter.Attestation) ([]byte, error) { var content []byte if att.ContentFunc != nil { data, err := att.ContentFunc() @@ -25,15 +25,8 @@ func ReadAll(ctx context.Context, s session.Group, refs map[string]cache.Immutab return nil, err } content = data - } else { - if refs == nil { - return nil, errors.Errorf("no refs map provided to lookup attestation keys") - } - ref, ok := refs[att.Ref] - if !ok { - return nil, errors.Errorf("key %s not found in refs map", att.Ref) - } - mount, err := ref.Mount(ctx, true, s) + } else if att.Ref != nil { + mount, err := att.Ref.Mount(ctx, true, s) if err != nil { return nil, err } @@ -52,6 +45,8 @@ func ReadAll(ctx context.Context, s session.Group, refs map[string]cache.Immutab if err != nil { return nil, errors.Wrap(err, "cannot read in-toto attestation") } + } else { + return nil, errors.New("no available content for attestation") } if len(content) == 0 { content = nil @@ -61,14 +56,14 @@ func ReadAll(ctx context.Context, s session.Group, refs map[string]cache.Immutab // MakeInTotoStatements iterates over all provided result attestations and // generates intoto attestation statements. -func MakeInTotoStatements(ctx context.Context, s session.Group, refs map[string]cache.ImmutableRef, attestations []result.Attestation, defaultSubjects []intoto.Subject) ([]intoto.Statement, error) { +func MakeInTotoStatements(ctx context.Context, s session.Group, attestations []exporter.Attestation, defaultSubjects []intoto.Subject) ([]intoto.Statement, error) { eg, ctx := errgroup.WithContext(ctx) statements := make([]intoto.Statement, len(attestations)) for i, att := range attestations { i, att := i, att eg.Go(func() error { - content, err := ReadAll(ctx, s, refs, att) + content, err := ReadAll(ctx, s, att) if err != nil { return err } @@ -92,7 +87,7 @@ func MakeInTotoStatements(ctx context.Context, s session.Group, refs map[string] return statements, nil } -func makeInTotoStatement(ctx context.Context, content []byte, attestation result.Attestation, defaultSubjects []intoto.Subject) (*intoto.Statement, error) { +func makeInTotoStatement(ctx context.Context, content []byte, attestation exporter.Attestation, defaultSubjects []intoto.Subject) (*intoto.Statement, error) { if len(attestation.InToto.Subjects) == 0 { attestation.InToto.Subjects = []result.InTotoSubject{{ Kind: gatewaypb.InTotoSubjectKindSelf, diff --git a/exporter/attestation/unbundle.go b/exporter/attestation/unbundle.go index b8bfa523ca80..a0dc21731b33 100644 --- a/exporter/attestation/unbundle.go +++ b/exporter/attestation/unbundle.go @@ -8,7 +8,7 @@ import ( "github.com/containerd/continuity/fs" intoto "github.com/in-toto/in-toto-golang/in_toto" - "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/exporter" gatewaypb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/session" "github.com/moby/buildkit/snapshot" @@ -19,9 +19,9 @@ import ( // Unbundle iterates over all provided result attestations and un-bundles any // bundled attestations by loading them from the provided refs map. -func Unbundle(ctx context.Context, s session.Group, refs map[string]cache.ImmutableRef, bundled []result.Attestation) ([]result.Attestation, error) { +func Unbundle(ctx context.Context, s session.Group, bundled []exporter.Attestation) ([]exporter.Attestation, error) { eg, ctx := errgroup.WithContext(ctx) - unbundled := make([][]result.Attestation, len(bundled)) + unbundled := make([][]exporter.Attestation, len(bundled)) for i, att := range bundled { i, att := i, att @@ -33,15 +33,11 @@ func Unbundle(ctx context.Context, s session.Group, refs map[string]cache.Immuta if att.ContentFunc != nil { return errors.New("attestation bundle cannot have callback") } - if refs == nil { - return errors.Errorf("no refs map provided to lookup attestation keys") - } - ref, ok := refs[att.Ref] - if !ok { - return errors.Errorf("key %s not found in refs map", att.Ref) + if att.Ref == nil { + return errors.Errorf("no ref provided for attestation bundle") } - mount, err := ref.Mount(ctx, true, s) + mount, err := att.Ref.Mount(ctx, true, s) if err != nil { return err } @@ -65,7 +61,7 @@ func Unbundle(ctx context.Context, s session.Group, refs map[string]cache.Immuta return nil, err } - var joined []result.Attestation + var joined []exporter.Attestation for _, atts := range unbundled { joined = append(joined, atts...) } @@ -77,7 +73,7 @@ func Unbundle(ctx context.Context, s session.Group, refs map[string]cache.Immuta return joined, nil } -func unbundle(ctx context.Context, root string, bundle result.Attestation) ([]result.Attestation, error) { +func unbundle(ctx context.Context, root string, bundle exporter.Attestation) ([]exporter.Attestation, error) { dir, err := fs.RootPath(root, bundle.Path) if err != nil { return nil, err @@ -87,7 +83,7 @@ func unbundle(ctx context.Context, root string, bundle result.Attestation) ([]re return nil, err } - var unbundled []result.Attestation + var unbundled []exporter.Attestation for _, entry := range entries { p, err := fs.RootPath(dir, entry.Name()) if err != nil { @@ -119,7 +115,7 @@ func unbundle(ctx context.Context, root string, bundle result.Attestation) ([]re Digest: result.FromDigestMap(subject.Digest), } } - unbundled = append(unbundled, result.Attestation{ + unbundled = append(unbundled, exporter.Attestation{ Kind: gatewaypb.AttestationKindInToto, Path: path.Join(bundle.Path, entry.Name()), ContentFunc: func() ([]byte, error) { return predicate, nil }, @@ -132,11 +128,11 @@ func unbundle(ctx context.Context, root string, bundle result.Attestation) ([]re return unbundled, nil } -func validate(att result.Attestation) error { +func validate(att exporter.Attestation) error { if att.Path == "" { return errors.New("attestation does not have set path") } - if att.Ref == "" && att.ContentFunc == nil { + if att.Ref == nil && att.ContentFunc == nil { return errors.New("attestation does not have available content") } return nil diff --git a/exporter/containerimage/attestations.go b/exporter/containerimage/attestations.go index 9ee6e900d2cf..680be58596d9 100644 --- a/exporter/containerimage/attestations.go +++ b/exporter/containerimage/attestations.go @@ -9,11 +9,11 @@ import ( intoto "github.com/in-toto/in-toto-golang/in_toto" "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/attestation" gatewaypb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/session" "github.com/moby/buildkit/solver" - "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/version" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -28,7 +28,7 @@ var intotoPlatform ocispecs.Platform = ocispecs.Platform{ } // supplementSBOM modifies SPDX attestations to include the file layers -func supplementSBOM(ctx context.Context, s session.Group, target cache.ImmutableRef, targetRemote *solver.Remote, refs map[string]cache.ImmutableRef, att result.Attestation) (result.Attestation, error) { +func supplementSBOM(ctx context.Context, s session.Group, target cache.ImmutableRef, targetRemote *solver.Remote, att exporter.Attestation) (exporter.Attestation, error) { if att.Kind != gatewaypb.AttestationKindInToto { return att, nil } @@ -36,7 +36,7 @@ func supplementSBOM(ctx context.Context, s session.Group, target cache.Immutable return att, nil } - content, err := attestation.ReadAll(ctx, s, refs, att) + content, err := attestation.ReadAll(ctx, s, att) if err != nil { return att, err } @@ -100,7 +100,7 @@ func supplementSBOM(ctx context.Context, s session.Group, target cache.Immutable return att, err } - return result.Attestation{ + return exporter.Attestation{ Kind: att.Kind, Path: att.Path, ContentFunc: func() ([]byte, error) { return content, nil }, diff --git a/exporter/containerimage/exptypes/parse.go b/exporter/containerimage/exptypes/parse.go new file mode 100644 index 000000000000..f77cd3f52565 --- /dev/null +++ b/exporter/containerimage/exptypes/parse.go @@ -0,0 +1,56 @@ +package exptypes + +import ( + "encoding/json" + "fmt" + + "github.com/containerd/containerd/platforms" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +func ParsePlatforms(meta map[string][]byte) (Platforms, error) { + if platformsBytes, ok := meta[ExporterPlatformsKey]; ok { + var ps Platforms + if len(platformsBytes) > 0 { + if err := json.Unmarshal(platformsBytes, &ps); err != nil { + return Platforms{}, errors.Wrapf(err, "failed to parse platforms passed to provenance processor") + } + } + return ps, nil + } + + p := platforms.DefaultSpec() + if imgConfig, ok := meta[ExporterImageConfigKey]; ok { + var img ocispecs.Image + err := json.Unmarshal(imgConfig, &img) + if err != nil { + return Platforms{}, err + } + + if img.OS != "" && img.Architecture != "" { + p = ocispecs.Platform{ + Architecture: img.Architecture, + OS: img.OS, + OSVersion: img.OSVersion, + OSFeatures: img.OSFeatures, + Variant: img.Variant, + } + } + } + p = platforms.Normalize(p) + pk := platforms.Format(p) + ps := Platforms{ + Platforms: []Platform{{ID: pk, Platform: p}}, + } + return ps, nil +} + +func ParseKey(meta map[string][]byte, key string, p Platform) []byte { + if v, ok := meta[fmt.Sprintf("%s/%s", key, p.ID)]; ok { + return v + } else if v, ok := meta[key]; ok { + return v + } + return nil +} diff --git a/exporter/containerimage/opts.go b/exporter/containerimage/opts.go index 50e57e7360c3..057bd299e4f2 100644 --- a/exporter/containerimage/opts.go +++ b/exporter/containerimage/opts.go @@ -6,7 +6,6 @@ import ( cacheconfig "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/exporter/util/epoch" - "github.com/moby/buildkit/exporter/util/multiplatform" "github.com/moby/buildkit/util/compression" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -35,7 +34,6 @@ type ImageCommitOpts struct { BuildInfoAttrs bool Annotations AnnotationsGroup Epoch *time.Time - MultiPlatform *bool } func (c *ImageCommitOpts) Load(opt map[string]string) (map[string]string, error) { @@ -52,11 +50,6 @@ func (c *ImageCommitOpts) Load(opt map[string]string) (map[string]string, error) return nil, err } - c.MultiPlatform, opt, err = multiplatform.ParseExporterAttrs(opt) - if err != nil { - return nil, err - } - for k, v := range opt { var err error switch k { diff --git a/exporter/containerimage/writer.go b/exporter/containerimage/writer.go index fa266e3d36bf..c37b77fdb8d9 100644 --- a/exporter/containerimage/writer.go +++ b/exporter/containerimage/writer.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "strconv" "strings" "time" @@ -57,26 +58,31 @@ type ImageWriter struct { } func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, sessionID string, opts *ImageCommitOpts) (*ocispecs.Descriptor, error) { - platformsBytes, ok := inp.Metadata[exptypes.ExporterPlatformsKey] - - if len(inp.Refs) > 0 && !ok { + if _, ok := inp.Metadata[exptypes.ExporterPlatformsKey]; len(inp.Refs) > 0 && !ok { return nil, errors.Errorf("unable to export multiple refs, missing platforms mapping") } - multiPlatform := len(inp.Refs) > 0 + isMap := len(inp.Refs) > 0 - var p exptypes.Platforms - if ok && len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &p); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to exporter") - } - if len(p.Platforms) > 1 { - multiPlatform = true - } + ps, err := exptypes.ParsePlatforms(inp.Metadata) + if err != nil { + return nil, err } - if opts.MultiPlatform != nil { - multiPlatform = *opts.MultiPlatform + requiredAttestations := false + for _, p := range ps.Platforms { + if atts, ok := inp.Attestations[p.ID]; ok { + atts = attestation.Filter(atts, nil, map[string][]byte{ + result.AttestationInlineOnlyKey: []byte(strconv.FormatBool(true)), + }) + if len(atts) > 0 { + requiredAttestations = true + break + } + } + } + if requiredAttestations { + isMap = true } if opts.Epoch == nil { @@ -89,10 +95,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session for pk, a := range opts.Annotations { if pk != "" { - if inp.Refs == nil { - return nil, errors.Errorf("invalid annotation: no platforms defined") - } - if _, ok := inp.Refs[pk]; !ok { + if _, ok := inp.FindRef(pk); !ok { return nil, errors.Errorf("invalid annotation: no platform %s found in source", pk) } } @@ -101,23 +104,23 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session } } - if !multiPlatform { - if len(p.Platforms) > 1 { + if !isMap { + if len(ps.Platforms) > 1 { return nil, errors.Errorf("cannot export multiple platforms without multi-platform enabled") } + if requiredAttestations { + return nil, errors.Errorf("cannot export attestations without multi-platform enabled") + } var ref cache.ImmutableRef - if inp.Ref != nil { - ref = inp.Ref - } else if len(p.Platforms) > 0 { - p := p.Platforms[0] - if _, ok := inp.Attestations[p.ID]; ok { - return nil, errors.Errorf("cannot export attestations without multi-platform enabled") - } - ref = inp.Refs[p.ID] - } else if len(inp.Refs) == 1 { - for _, ref = range inp.Refs { + var p exptypes.Platform + if len(ps.Platforms) > 0 { + p = ps.Platforms[0] + if r, ok := inp.FindRef(p.ID); ok { + ref = r } + } else { + ref = inp.Ref } remotes, err := ic.exportLayers(ctx, opts.RefCfg, session.NewGroup(sessionID), ref) @@ -127,7 +130,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session var dtbi []byte if opts.BuildInfo { - if dtbi, err = buildinfo.Format(inp.Metadata[exptypes.ExporterBuildInfo], buildinfo.FormatOpts{ + if dtbi, err = buildinfo.Format(exptypes.ParseKey(inp.Metadata, exptypes.ExporterBuildInfo, p), buildinfo.FormatOpts{ RemoveAttrs: !opts.BuildInfoAttrs, }); err != nil { return nil, err @@ -139,43 +142,35 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session return nil, errors.Errorf("index annotations not supported for single platform export") } - mfstDesc, configDesc, err := ic.commitDistributionManifest(ctx, opts, ref, inp.Metadata[exptypes.ExporterImageConfigKey], &remotes[0], annotations, inp.Metadata[exptypes.ExporterInlineCache], dtbi, opts.Epoch, session.NewGroup(sessionID)) + config := exptypes.ParseKey(inp.Metadata, exptypes.ExporterImageConfigKey, p) + inlineCache := exptypes.ParseKey(inp.Metadata, exptypes.ExporterInlineCache, p) + mfstDesc, configDesc, err := ic.commitDistributionManifest(ctx, opts, ref, config, &remotes[0], annotations, inlineCache, dtbi, opts.Epoch, session.NewGroup(sessionID)) if err != nil { return nil, err } if mfstDesc.Annotations == nil { mfstDesc.Annotations = make(map[string]string) } - if len(p.Platforms) == 1 { - mfstDesc.Platform = &p.Platforms[0].Platform + if len(ps.Platforms) == 1 { + mfstDesc.Platform = &ps.Platforms[0].Platform } mfstDesc.Annotations[exptypes.ExporterConfigDigestKey] = configDesc.Digest.String() return mfstDesc, nil } - refCount := len(p.Platforms) - hasAttestations := false - for _, attests := range inp.Attestations { - hasAttestations = true - for _, attest := range attests { - if attest.Ref != "" { - refCount++ - } - } - } - if refCount != len(inp.Refs) { - return nil, errors.Errorf("number of required refs (%d) does not match number of references (%d)", refCount, len(inp.Refs)) - } - - if hasAttestations { + if len(inp.Attestations) > 0 { opts.EnableOCITypes("attestations") } refs := make([]cache.ImmutableRef, 0, len(inp.Refs)) remotesMap := make(map[string]int, len(inp.Refs)) - for id, r := range inp.Refs { - remotesMap[id] = len(refs) + for _, p := range ps.Platforms { + r, ok := inp.FindRef(p.ID) + if !ok { + return nil, errors.Errorf("failed to find ref for ID %s", p.ID) + } + remotesMap[p.ID] = len(refs) refs = append(refs, r) } @@ -208,17 +203,17 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session var attestationManifests []ocispecs.Descriptor - for i, p := range p.Platforms { - r, ok := inp.Refs[p.ID] + for i, p := range ps.Platforms { + r, ok := inp.FindRef(p.ID) if !ok { return nil, errors.Errorf("failed to find ref for ID %s", p.ID) } - config := inp.Metadata[fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, p.ID)] - inlineCache := inp.Metadata[fmt.Sprintf("%s/%s", exptypes.ExporterInlineCache, p.ID)] + config := exptypes.ParseKey(inp.Metadata, exptypes.ExporterImageConfigKey, p) + inlineCache := exptypes.ParseKey(inp.Metadata, exptypes.ExporterInlineCache, p) var dtbi []byte if opts.BuildInfo { - if dtbi, err = buildinfo.Format(inp.Metadata[fmt.Sprintf("%s/%s", exptypes.ExporterBuildInfo, p.ID)], buildinfo.FormatOpts{ + if dtbi, err = buildinfo.Format(exptypes.ParseKey(inp.Metadata, exptypes.ExporterBuildInfo, p), buildinfo.FormatOpts{ RemoveAttrs: !opts.BuildInfoAttrs, }); err != nil { return nil, err @@ -243,7 +238,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = desc.Digest.String() if attestations, ok := inp.Attestations[p.ID]; ok { - attestations, err := attestation.Unbundle(ctx, session.NewGroup(sessionID), inp.Refs, attestations) + attestations, err := attestation.Unbundle(ctx, session.NewGroup(sessionID), attestations) if err != nil { return nil, err } @@ -252,7 +247,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session for i, att := range attestations { i, att := i, att eg.Go(func() error { - att, err := supplementSBOM(ctx2, session.NewGroup(sessionID), r, remote, inp.Refs, att) + att, err := supplementSBOM(ctx2, session.NewGroup(sessionID), r, remote, att) if err != nil { return err } @@ -278,7 +273,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session Digest: result.ToDigestMap(desc.Digest), }) } - stmts, err := attestation.MakeInTotoStatements(ctx, session.NewGroup(sessionID), inp.Refs, attestations, defaultSubjects) + stmts, err := attestation.MakeInTotoStatements(ctx, session.NewGroup(sessionID), attestations, defaultSubjects) if err != nil { return nil, err } @@ -294,7 +289,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session for i, mfst := range attestationManifests { idx.Manifests = append(idx.Manifests, mfst) - labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", len(p.Platforms)+i)] = mfst.Digest.String() + labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", len(ps.Platforms)+i)] = mfst.Digest.String() } idxBytes, err := json.MarshalIndent(idx, "", " ") diff --git a/exporter/exporter.go b/exporter/exporter.go index 967d06c1af87..3a6c7a139285 100644 --- a/exporter/exporter.go +++ b/exporter/exporter.go @@ -10,6 +10,8 @@ import ( type Source = result.Result[cache.ImmutableRef] +type Attestation = result.Attestation[cache.ImmutableRef] + type Exporter interface { Resolve(context.Context, map[string]string) (ExporterInstance, error) } diff --git a/exporter/local/export.go b/exporter/local/export.go index ab0b206977fd..81e18f826bb1 100644 --- a/exporter/local/export.go +++ b/exporter/local/export.go @@ -2,7 +2,6 @@ package local import ( "context" - "encoding/json" "os" "strings" "time" @@ -11,10 +10,8 @@ import ( "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/exporter/util/epoch" - "github.com/moby/buildkit/exporter/util/multiplatform" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" - "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/util/progress" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" @@ -47,16 +44,10 @@ func (e *localExporter) Resolve(ctx context.Context, opt map[string]string) (exp return nil, err } - multiPlatform, _, err := multiplatform.ParseExporterAttrs(opt) - if err != nil { - return nil, err - } - i := &localExporterInstance{ localExporter: e, opts: CreateFSOpts{ - Epoch: tm, - MultiPlatform: multiPlatform, + Epoch: tm, }, } @@ -102,33 +93,23 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source isMap := len(inp.Refs) > 0 - platformsBytes, ok := inp.Metadata[exptypes.ExporterPlatformsKey] - if len(inp.Refs) > 0 && !ok { + if _, ok := inp.Metadata[exptypes.ExporterPlatformsKey]; isMap && !ok { return nil, errors.Errorf("unable to export multiple refs, missing platforms mapping") } - - var p exptypes.Platforms - if ok && len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &p); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to exporter") - } - if len(p.Platforms) > 1 { - isMap = true - } + p, err := exptypes.ParsePlatforms(inp.Metadata) + if err != nil { + return nil, err } - if e.opts.MultiPlatform != nil { - isMap = *e.opts.MultiPlatform - } if !isMap && len(p.Platforms) > 1 { return nil, errors.Errorf("unable to export multiple platforms without map") } now := time.Now().Truncate(time.Second) - export := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []result.Attestation) func() error { + export := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []exporter.Attestation) func() error { return func() error { - outputFS, cleanup, err := CreateFS(ctx, sessionID, k, ref, inp.Refs, attestations, now, e.opts) + outputFS, cleanup, err := CreateFS(ctx, sessionID, k, ref, attestations, now, e.opts) if err != nil { return err } @@ -163,16 +144,13 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source eg, ctx := errgroup.WithContext(ctx) - if len(inp.Refs) > 0 { + if len(p.Platforms) > 0 { for _, p := range p.Platforms { - r, ok := inp.Refs[p.ID] + r, ok := inp.FindRef(p.ID) if !ok { return nil, errors.Errorf("failed to find ref for ID %s", p.ID) } eg.Go(export(ctx, p.ID, r, inp.Attestations[p.ID])) - if !isMap { - break - } } } else { eg.Go(export(ctx, "", inp.Ref, nil)) diff --git a/exporter/local/fs.go b/exporter/local/fs.go index 07d524f73b6a..bb90cfdd0d32 100644 --- a/exporter/local/fs.go +++ b/exporter/local/fs.go @@ -13,6 +13,7 @@ import ( "github.com/docker/docker/pkg/idtools" intoto "github.com/in-toto/in-toto-golang/in_toto" "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/attestation" "github.com/moby/buildkit/session" "github.com/moby/buildkit/snapshot" @@ -27,10 +28,9 @@ import ( type CreateFSOpts struct { Epoch *time.Time AttestationPrefix string - MultiPlatform *bool } -func CreateFS(ctx context.Context, sessionID string, k string, ref cache.ImmutableRef, refs map[string]cache.ImmutableRef, attestations []result.Attestation, defaultTime time.Time, opt CreateFSOpts) (fsutil.FS, func() error, error) { +func CreateFS(ctx context.Context, sessionID string, k string, ref cache.ImmutableRef, attestations []exporter.Attestation, defaultTime time.Time, opt CreateFSOpts) (fsutil.FS, func() error, error) { var cleanup func() error var src string var err error @@ -92,7 +92,7 @@ func CreateFS(ctx context.Context, sessionID string, k string, ref cache.Immutab attestations = attestation.Filter(attestations, nil, map[string][]byte{ result.AttestationInlineOnlyKey: []byte(strconv.FormatBool(true)), }) - attestations, err = attestation.Unbundle(ctx, session.NewGroup(sessionID), refs, attestations) + attestations, err = attestation.Unbundle(ctx, session.NewGroup(sessionID), attestations) if err != nil { return nil, nil, err } @@ -124,7 +124,7 @@ func CreateFS(ctx context.Context, sessionID string, k string, ref cache.Immutab return nil, nil, err } - stmts, err := attestation.MakeInTotoStatements(ctx, session.NewGroup(sessionID), refs, attestations, subjects) + stmts, err := attestation.MakeInTotoStatements(ctx, session.NewGroup(sessionID), attestations, subjects) if err != nil { return nil, nil, err } diff --git a/exporter/tar/export.go b/exporter/tar/export.go index 186a4b3ea164..7cd057b838ca 100644 --- a/exporter/tar/export.go +++ b/exporter/tar/export.go @@ -2,7 +2,6 @@ package local import ( "context" - "encoding/json" "os" "strconv" "strings" @@ -13,10 +12,8 @@ import ( "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/exporter/local" "github.com/moby/buildkit/exporter/util/epoch" - "github.com/moby/buildkit/exporter/util/multiplatform" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" - "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/util/progress" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" @@ -55,12 +52,6 @@ func (e *localExporter) Resolve(ctx context.Context, opt map[string]string) (exp } li.opts.Epoch = tm - multiPlatform, opt, err := multiplatform.ParseExporterAttrs(opt) - if err != nil { - return nil, err - } - li.opts.MultiPlatform = multiPlatform - for k, v := range opt { switch k { case preferNondistLayersKey: @@ -110,8 +101,8 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source now := time.Now().Truncate(time.Second) - getDir := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []result.Attestation) (*fsutil.Dir, error) { - outputFS, cleanup, err := local.CreateFS(ctx, sessionID, k, ref, inp.Refs, attestations, now, e.opts) + getDir := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []exporter.Attestation) (*fsutil.Dir, error) { + outputFS, cleanup, err := local.CreateFS(ctx, sessionID, k, ref, attestations, now, e.opts) if err != nil { return nil, err } @@ -134,24 +125,12 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source } isMap := len(inp.Refs) > 0 - - platformsBytes, ok := inp.Metadata[exptypes.ExporterPlatformsKey] - if len(inp.Refs) > 0 && !ok { + if _, ok := inp.Metadata[exptypes.ExporterPlatformsKey]; isMap && !ok { return nil, errors.Errorf("unable to export multiple refs, missing platforms mapping") } - - var p exptypes.Platforms - if ok && len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &p); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to exporter") - } - if len(p.Platforms) > 1 { - isMap = true - } - } - - if e.opts.MultiPlatform != nil { - isMap = *e.opts.MultiPlatform + p, err := exptypes.ParsePlatforms(inp.Metadata) + if err != nil { + return nil, err } if !isMap && len(p.Platforms) > 1 { return nil, errors.Errorf("unable to export multiple platforms without map") @@ -159,10 +138,10 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source var fs fsutil.FS - if len(inp.Refs) > 0 { + if len(p.Platforms) > 0 { dirs := make([]fsutil.Dir, 0, len(p.Platforms)) for _, p := range p.Platforms { - r, ok := inp.Refs[p.ID] + r, ok := inp.FindRef(p.ID) if !ok { return nil, errors.Errorf("failed to find ref for ID %s", p.ID) } @@ -170,10 +149,6 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source if err != nil { return nil, err } - if !isMap { - fs = d.FS - break - } dirs = append(dirs, *d) } if isMap { @@ -182,6 +157,8 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source if err != nil { return nil, err } + } else { + fs = dirs[0].FS } } else { d, err := getDir(ctx, "", inp.Ref, nil) diff --git a/exporter/util/multiplatform/parse.go b/exporter/util/multiplatform/parse.go deleted file mode 100644 index a9d6ef631851..000000000000 --- a/exporter/util/multiplatform/parse.go +++ /dev/null @@ -1,45 +0,0 @@ -package multiplatform - -import ( - "strconv" - - "github.com/pkg/errors" -) - -const ( - frontendMultiPlatform = "multi-platform" - frontendMultiPlatformArg = "build-arg:BUILDKIT_MULTI_PLATFORM" - - KeyMultiPlatform = "multi-platform" -) - -func ParseBuildArgs(opt map[string]string) (string, bool) { - if v, ok := opt[frontendMultiPlatform]; ok { - return v, true - } - if v, ok := opt[frontendMultiPlatformArg]; ok { - return v, true - } - return "", false -} - -func ParseExporterAttrs(opt map[string]string) (*bool, map[string]string, error) { - rest := make(map[string]string, len(opt)) - - var multiPlatform *bool - - for k, v := range opt { - switch k { - case KeyMultiPlatform: - b, err := strconv.ParseBool(v) - if err != nil { - return nil, nil, errors.Errorf("invalid boolean value %s", v) - } - multiPlatform = &b - default: - rest[k] = v - } - } - - return multiPlatform, rest, nil -} diff --git a/frontend/attestations/sbom/sbom.go b/frontend/attestations/sbom/sbom.go index c5f07ea27c19..74ac0a2d15f3 100644 --- a/frontend/attestations/sbom/sbom.go +++ b/frontend/attestations/sbom/sbom.go @@ -28,7 +28,7 @@ const ( // build-contexts or multi-stage builds. Handling these separately allows the // scanner to optionally ignore these or to mark them as such in the // attestation. -type Scanner func(ctx context.Context, name string, ref llb.State, extras map[string]llb.State) (result.Attestation, llb.State, error) +type Scanner func(ctx context.Context, name string, ref llb.State, extras map[string]llb.State) (result.Attestation[llb.State], error) func CreateSBOMScanner(ctx context.Context, resolver llb.ImageMetaResolver, scanner string) (Scanner, error) { if scanner == "" { @@ -52,7 +52,7 @@ func CreateSBOMScanner(ctx context.Context, resolver llb.ImageMetaResolver, scan return nil, errors.Errorf("scanner %s does not have cmd", scanner) } - return func(ctx context.Context, name string, ref llb.State, extras map[string]llb.State) (result.Attestation, llb.State, error) { + return func(ctx context.Context, name string, ref llb.State, extras map[string]llb.State) (result.Attestation[llb.State], error) { var env []string env = append(env, cfg.Config.Env...) env = append(env, "BUILDKIT_SCAN_DESTINATION="+outDir) @@ -78,15 +78,16 @@ func CreateSBOMScanner(ctx context.Context, resolver llb.ImageMetaResolver, scan } stsbom := runscan.AddMount(outDir, llb.Scratch()) - return result.Attestation{ + return result.Attestation[llb.State]{ Kind: gatewaypb.AttestationKindBundle, + Ref: stsbom, Metadata: map[string][]byte{ result.AttestationReasonKey: result.AttestationReasonSBOM, }, InToto: result.InTotoAttestation{ PredicateType: intoto.PredicateSPDX, }, - }, stsbom, nil + }, nil }, nil } diff --git a/frontend/dockerfile/builder/build.go b/frontend/dockerfile/builder/build.go index 52d05dd6279f..790b758c0637 100644 --- a/frontend/dockerfile/builder/build.go +++ b/frontend/dockerfile/builder/build.go @@ -32,6 +32,7 @@ import ( "github.com/moby/buildkit/frontend/subrequests/targets" "github.com/moby/buildkit/solver/errdefs" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/util/gitutil" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -504,7 +505,6 @@ func Build(ctx context.Context, c client.Client) (_ *client.Result, err error) { return nil, errors.Wrapf(err, "failed to parse sbom scanner %s", src) } ref = reference.TagNameOnly(ref) - exportMap = true scanner, err = sbom.CreateSBOMScanner(ctx, c, ref.String()) if err != nil { @@ -613,23 +613,28 @@ func Build(ctx context.Context, c client.Client) (_ *client.Result, err error) { if scanner != nil { for i, p := range expPlatforms.Platforms { - att, st, err := scanner(ctx, p.ID, scanTargets[i].Core, scanTargets[i].Extras) + att, err := scanner(ctx, p.ID, scanTargets[i].Core, scanTargets[i].Extras) if err != nil { return nil, err } - def, err := st.Marshal(ctx) - if err != nil { - return nil, err - } - r, err := c.Solve(ctx, frontend.SolveRequest{ - Definition: def.ToPB(), + attSolve, err := result.ConvertAttestation(&att, func(st llb.State) (client.Reference, error) { + def, err := st.Marshal(ctx) + if err != nil { + return nil, err + } + r, err := c.Solve(ctx, frontend.SolveRequest{ + Definition: def.ToPB(), + }) + if err != nil { + return nil, err + } + return r.Ref, nil }) if err != nil { return nil, err } - - res.AddAttestation(p.ID, att, r.Ref) + res.AddAttestation(p.ID, *attSolve) } } diff --git a/frontend/frontend.go b/frontend/frontend.go index 2409891cb1f4..024ac802045c 100644 --- a/frontend/frontend.go +++ b/frontend/frontend.go @@ -14,6 +14,8 @@ import ( type Result = result.Result[solver.ResultProxy] +type Attestation = result.Attestation[solver.ResultProxy] + type Frontend interface { Solve(ctx context.Context, llb FrontendLLBBridge, opt map[string]string, inputs map[string]*pb.Definition, sid string, sm *session.Manager) (*Result, error) } diff --git a/frontend/gateway/client/attestation.go b/frontend/gateway/client/attestation.go index 7267ce80550e..5ffe67233c50 100644 --- a/frontend/gateway/client/attestation.go +++ b/frontend/gateway/client/attestation.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" ) -func AttestationToPB(a *result.Attestation) (*pb.Attestation, error) { +func AttestationToPB[T any](a *result.Attestation[T]) (*pb.Attestation, error) { if a.ContentFunc != nil { return nil, errors.Errorf("attestation callback cannot be sent through gateway") } @@ -22,14 +22,14 @@ func AttestationToPB(a *result.Attestation) (*pb.Attestation, error) { return &pb.Attestation{ Kind: a.Kind, + Metadata: a.Metadata, Path: a.Path, - Ref: a.Ref, InTotoPredicateType: a.InToto.PredicateType, InTotoSubjects: subjects, }, nil } -func AttestationFromPB(a *pb.Attestation) (*result.Attestation, error) { +func AttestationFromPB[T any](a *pb.Attestation) (*result.Attestation[T], error) { subjects := make([]result.InTotoSubject, len(a.InTotoSubjects)) for i, subject := range a.InTotoSubjects { subjects[i] = result.InTotoSubject{ @@ -39,10 +39,10 @@ func AttestationFromPB(a *pb.Attestation) (*result.Attestation, error) { } } - return &result.Attestation{ - Kind: a.Kind, - Path: a.Path, - Ref: a.Ref, + return &result.Attestation[T]{ + Kind: a.Kind, + Metadata: a.Metadata, + Path: a.Path, InToto: result.InTotoAttestation{ PredicateType: a.InTotoPredicateType, Subjects: subjects, diff --git a/frontend/gateway/client/client.go b/frontend/gateway/client/client.go index 78d2e24528c4..ae6d297fd71a 100644 --- a/frontend/gateway/client/client.go +++ b/frontend/gateway/client/client.go @@ -16,6 +16,8 @@ import ( type Result = result.Result[Reference] +type Attestation = result.Attestation[Reference] + type BuildFunc func(context.Context, Client) (*Result, error) func NewResult() *Result { diff --git a/frontend/gateway/gateway.go b/frontend/gateway/gateway.go index 7a610764c967..b96015550a94 100644 --- a/frontend/gateway/gateway.go +++ b/frontend/gateway/gateway.go @@ -694,6 +694,13 @@ func (lbf *llbBridgeForwarder) Solve(ctx context.Context, req *pb.SolveRequest) return nil, err } + if att.Ref != nil { + id := identity.NewID() + def := att.Ref.Definition() + lbf.refs[id] = att.Ref + pbAtt.Ref = &pb.Ref{Id: id, Def: def} + } + if pbRes.Attestations[k] == nil { pbRes.Attestations[k] = &pb.Attestations{} } @@ -915,11 +922,18 @@ func (lbf *llbBridgeForwarder) Return(ctx context.Context, in *pb.ReturnRequest) if in.Result.Attestations != nil { for k, pbAtts := range in.Result.Attestations { for _, pbAtt := range pbAtts.Attestation { - att, err := gwclient.AttestationFromPB(pbAtt) + att, err := gwclient.AttestationFromPB[solver.ResultProxy](pbAtt) if err != nil { return nil, err } - r.AddAttestation(k, *att, nil) + if pbAtt.Ref != nil { + ref, err := lbf.cloneRef(pbAtt.Ref.Id) + if err != nil { + return nil, err + } + att.Ref = ref + } + r.AddAttestation(k, *att) } } } diff --git a/frontend/gateway/grpcclient/client.go b/frontend/gateway/grpcclient/client.go index 958efe12f7c6..70064e5cf47f 100644 --- a/frontend/gateway/grpcclient/client.go +++ b/frontend/gateway/grpcclient/client.go @@ -161,7 +161,7 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro } } - if res.Attestations != nil && c.caps.Supports(pb.CapAttestations) == nil { + if res.Attestations != nil { attestations := map[string]*pb.Attestations{} for k, as := range res.Attestations { for _, a := range as { @@ -170,6 +170,12 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro retError = err continue } + pbRef, err := convertRef(a.Ref) + if err != nil { + retError = err + continue + } + pbAtt.Ref = pbRef if attestations[k] == nil { attestations[k] = &pb.Attestations{} } @@ -451,11 +457,18 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res * if resp.Result.Attestations != nil { for p, as := range resp.Result.Attestations { for _, a := range as.Attestation { - att, err := client.AttestationFromPB(a) + att, err := client.AttestationFromPB[client.Reference](a) if err != nil { return nil, err } - res.AddAttestation(p, *att, nil) + if a.Ref.Id != "" { + ref, err := newReference(c, a.Ref) + if err != nil { + return nil, err + } + att.Ref = ref + } + res.AddAttestation(p, *att) } } } diff --git a/frontend/gateway/pb/gateway.pb.go b/frontend/gateway/pb/gateway.pb.go index 86b6bde848d4..038515b4d2ba 100644 --- a/frontend/gateway/pb/gateway.pb.go +++ b/frontend/gateway/pb/gateway.pb.go @@ -411,14 +411,15 @@ func (m *Attestations) GetAttestation() []*Attestation { } type Attestation struct { - Kind AttestationKind `protobuf:"varint,1,opt,name=kind,proto3,enum=moby.buildkit.v1.frontend.AttestationKind" json:"kind,omitempty"` - Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"` - Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` - InTotoPredicateType string `protobuf:"bytes,4,opt,name=inTotoPredicateType,proto3" json:"inTotoPredicateType,omitempty"` - InTotoSubjects []*InTotoSubject `protobuf:"bytes,5,rep,name=inTotoSubjects,proto3" json:"inTotoSubjects,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Kind AttestationKind `protobuf:"varint,1,opt,name=kind,proto3,enum=moby.buildkit.v1.frontend.AttestationKind" json:"kind,omitempty"` + Metadata map[string][]byte `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Ref *Ref `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + InTotoPredicateType string `protobuf:"bytes,5,opt,name=inTotoPredicateType,proto3" json:"inTotoPredicateType,omitempty"` + InTotoSubjects []*InTotoSubject `protobuf:"bytes,6,rep,name=inTotoSubjects,proto3" json:"inTotoSubjects,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Attestation) Reset() { *m = Attestation{} } @@ -461,11 +462,18 @@ func (m *Attestation) GetKind() AttestationKind { return AttestationKindInToto } -func (m *Attestation) GetRef() string { +func (m *Attestation) GetMetadata() map[string][]byte { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *Attestation) GetRef() *Ref { if m != nil { return m.Ref } - return "" + return nil } func (m *Attestation) GetPath() string { @@ -2556,6 +2564,7 @@ func init() { proto.RegisterMapType((map[string]*Ref)(nil), "moby.buildkit.v1.frontend.RefMap.RefsEntry") proto.RegisterType((*Attestations)(nil), "moby.buildkit.v1.frontend.Attestations") proto.RegisterType((*Attestation)(nil), "moby.buildkit.v1.frontend.Attestation") + proto.RegisterMapType((map[string][]byte)(nil), "moby.buildkit.v1.frontend.Attestation.MetadataEntry") proto.RegisterType((*InTotoSubject)(nil), "moby.buildkit.v1.frontend.InTotoSubject") proto.RegisterType((*ReturnRequest)(nil), "moby.buildkit.v1.frontend.ReturnRequest") proto.RegisterType((*ReturnResponse)(nil), "moby.buildkit.v1.frontend.ReturnResponse") @@ -2600,157 +2609,157 @@ func init() { func init() { proto.RegisterFile("gateway.proto", fileDescriptor_f1a937782ebbded5) } var fileDescriptor_f1a937782ebbded5 = []byte{ - // 2387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x19, 0x4d, 0x6f, 0x1b, 0xc7, - 0x55, 0x2b, 0x52, 0x1f, 0x7c, 0xa4, 0x28, 0x7a, 0xec, 0x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 0x09, 0x31, 0x53, 0x8d, 0x91, 0xf9, 0x33, 0x53, 0x8d, 0xb1, 0x91, 0xb3, - 0x3d, 0x78, 0x08, 0x66, 0x0a, 0x19, 0x99, 0x37, 0x33, 0x85, 0x8c, 0x8e, 0x9d, 0xe4, 0x29, 0xe4, - 0x71, 0xec, 0x24, 0x59, 0xe5, 0x57, 0x9b, 0x4b, 0xad, 0xac, 0x98, 0x18, 0x9a, 0x57, 0x7f, 0x86, - 0x6d, 0x4a, 0xbc, 0xf9, 0xb3, 0x1b, 0x94, 0xf6, 0xa1, 0xce, 0xba, 0x39, 0x03, 0xe6, 0x80, 0xbd, - 0x7a, 0x2f, 0xd7, 0x66, 0xf8, 0x5a, 0x36, 0x9d, 0xfd, 0xc8, 0x77, 0xb9, 0x10, 0x4a, 0xfa, 0xf4, - 0x41, 0xea, 0x19, 0xa4, 0x13, 0x06, 0x37, 0xab, 0x31, 0x33, 0xbe, 0x12, 0xf8, 0x05, 0xbe, 0xbd, - 0x86, 0x27, 0x13, 0xd2, 0xcc, 0x34, 0xc7, 0xc4, 0x19, 0xc8, 0xba, 0x7d, 0x21, 0x1a, 0x25, 0xdc, - 0x91, 0x93, 0x8f, 0x9a, 0x6e, 0x48, 0x76, 0x23, 0xef, 0x4f, 0x48, 0xd6, 0x8c, 0x78, 0x35, 0xe3, - 0x7d, 0x03, 0xe3, 0x0c, 0x27, 0xde, 0x4c, 0xde, 0xda, 0x53, 0x20, 0x33, 0xce, 0xf4, 0xd1, 0x79, - 0xb3, 0xf4, 0xf5, 0xab, 0x6b, 0xc6, 0x3f, 0x5e, 0x5d, 0x33, 0xfe, 0xfd, 0xea, 0x9a, 0x71, 0xbc, - 0x28, 0xfe, 0xcf, 0xbb, 0xfd, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x22, 0xd0, 0xf5, 0x61, 0x21, - 0x1d, 0x00, 0x00, + // 2395 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0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0xc8, 0xfb, 0x90, 0x7b, 0xc4, 0xf8, 0x59, 0x10, 0x3d, 0x17, 0x5a, 0x57, 0x9a, 0x45, 0xc4, + 0x79, 0xc4, 0x38, 0xce, 0x55, 0x34, 0x39, 0xc3, 0x61, 0x2d, 0x4c, 0x86, 0xb5, 0xec, 0xa4, 0x61, + 0x2d, 0x39, 0x25, 0x9b, 0x50, 0x6c, 0x07, 0x7e, 0xcc, 0x23, 0xdb, 0x45, 0xc1, 0x4b, 0x02, 0xf9, + 0x4d, 0x44, 0x96, 0x8e, 0xdd, 0x1e, 0x1c, 0x52, 0x1d, 0x93, 0x6c, 0x00, 0xb0, 0x97, 0x3c, 0xb2, + 0xf7, 0x83, 0xb8, 0xff, 0xb0, 0x01, 0xa4, 0x43, 0xc0, 0x41, 0x8b, 0x6a, 0xa7, 0xd6, 0x5b, 0x70, + 0x79, 0xd8, 0x22, 0xca, 0x54, 0xf7, 0xe0, 0xff, 0x28, 0xf3, 0x98, 0x1d, 0xb3, 0xf9, 0xad, 0x65, + 0x99, 0x50, 0x1b, 0x27, 0x56, 0x8c, 0xff, 0x93, 0x81, 0xe2, 0xee, 0x4b, 0xd6, 0x3e, 0x62, 0x71, + 0x6c, 0x77, 0xc5, 0xc8, 0xd8, 0x8a, 0x82, 0x36, 0x8b, 0xe3, 0x3e, 0xaf, 0x01, 0x80, 0x7c, 0x1f, + 0xb2, 0x07, 0xbe, 0xcb, 0x55, 0x7f, 0x5c, 0x4b, 0x9d, 0xd8, 0x5d, 0xae, 0x78, 0xee, 0x2f, 0x50, + 0x41, 0x45, 0xee, 0x42, 0x16, 0xab, 0xcb, 0x2c, 0x15, 0xde, 0xd1, 0x68, 0x91, 0x86, 0x6c, 0x89, + 0x2f, 0x6b, 0xee, 0x97, 0x4c, 0x79, 0x69, 0x3d, 0xbd, 0x35, 0xb9, 0x5f, 0xb2, 0x01, 0x07, 0x45, + 0x49, 0x76, 0x21, 0x77, 0xcc, 0xed, 0x88, 0x33, 0x47, 0x79, 0xef, 0x7a, 0xda, 0x04, 0x23, 0x31, + 0x07, 0x5c, 0x12, 0x5a, 0x34, 0xc2, 0xee, 0x4b, 0x97, 0xab, 0x6c, 0x48, 0x33, 0x02, 0xa2, 0x69, + 0x8a, 0xe0, 0x16, 0xa9, 0x77, 0x02, 0x9f, 0xd5, 0x72, 0x53, 0xa9, 0x11, 0x4d, 0xa3, 0xc6, 0x2d, + 0x9a, 0xe1, 0xd8, 0xed, 0xe2, 0x60, 0x98, 0x9f, 0x6a, 0x06, 0x89, 0xa8, 0x99, 0x41, 0x02, 0xb6, + 0x72, 0xb0, 0x24, 0xc6, 0x20, 0xeb, 0xb7, 0x06, 0x14, 0x35, 0x3f, 0xcd, 0x90, 0x77, 0xef, 0x40, + 0x16, 0x5f, 0xd5, 0xca, 0xff, 0x79, 0x91, 0x75, 0x8c, 0xdb, 0x54, 0x40, 0xb1, 0x70, 0xec, 0x39, + 0xb2, 0x28, 0x96, 0x29, 0x2e, 0x11, 0xf2, 0x84, 0x9f, 0x0b, 0x97, 0xe5, 0x29, 0x2e, 0xc9, 0x0d, + 0xc8, 0x1f, 0xb3, 0x76, 0x2f, 0x72, 0xf9, 0xb9, 0x70, 0x42, 0xa5, 0x59, 0x15, 0xe5, 0x44, 0xc1, + 0x44, 0x72, 0xf6, 0x31, 0xac, 0x87, 0x18, 0x9c, 0x83, 0x0b, 0x12, 0xc8, 0x6e, 0xe3, 0x43, 0x09, + 0x6f, 0x56, 0xa6, 0x62, 0x8d, 0x6f, 0xd5, 0xdd, 0x69, 0x6f, 0xd5, 0xdd, 0xe4, 0xad, 0x3a, 0xec, + 0x54, 0xec, 0x3e, 0x9a, 0x91, 0xad, 0x07, 0x50, 0xe8, 0x07, 0x1e, 0xa9, 0xc0, 0xe2, 0x9e, 0xa3, + 0x24, 0x2d, 0xee, 0x39, 0xa8, 0xca, 0xee, 0xe3, 0x3d, 0x21, 0x25, 0x4f, 0x71, 0xd9, 0x1f, 0x12, + 0x32, 0xda, 0x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00, + 0x00, 0xff, 0xff, 0x76, 0x21, 0x31, 0x33, 0xd0, 0x1d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3695,7 +3704,7 @@ func (m *Attestation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGateway(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } } if len(m.InTotoPredicateType) > 0 { @@ -3703,21 +3712,47 @@ func (m *Attestation) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.InTotoPredicateType) i = encodeVarintGateway(dAtA, i, uint64(len(m.InTotoPredicateType))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.Path) > 0 { i -= len(m.Path) copy(dAtA[i:], m.Path) i = encodeVarintGateway(dAtA, i, uint64(len(m.Path))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } - if len(m.Ref) > 0 { - i -= len(m.Ref) - copy(dAtA[i:], m.Ref) - i = encodeVarintGateway(dAtA, i, uint64(len(m.Ref))) + if m.Ref != nil { + { + size, err := m.Ref.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGateway(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if len(m.Metadata) > 0 { + for k := range m.Metadata { + v := m.Metadata[k] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintGateway(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintGateway(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintGateway(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + } } if m.Kind != 0 { i = encodeVarintGateway(dAtA, i, uint64(m.Kind)) @@ -5271,20 +5306,20 @@ func (m *InitMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if len(m.Fds) > 0 { - dAtA27 := make([]byte, len(m.Fds)*10) - var j26 int + dAtA28 := make([]byte, len(m.Fds)*10) + var j27 int for _, num := range m.Fds { for num >= 1<<7 { - dAtA27[j26] = uint8(uint64(num)&0x7f | 0x80) + dAtA28[j27] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j26++ + j27++ } - dAtA27[j26] = uint8(num) - j26++ + dAtA28[j27] = uint8(num) + j27++ } - i -= j26 - copy(dAtA[i:], dAtA27[:j26]) - i = encodeVarintGateway(dAtA, i, uint64(j26)) + i -= j27 + copy(dAtA[i:], dAtA28[:j27]) + i = encodeVarintGateway(dAtA, i, uint64(j27)) i-- dAtA[i] = 0x1a } @@ -5717,8 +5752,20 @@ func (m *Attestation) Size() (n int) { if m.Kind != 0 { n += 1 + sovGateway(uint64(m.Kind)) } - l = len(m.Ref) - if l > 0 { + if len(m.Metadata) > 0 { + for k, v := range m.Metadata { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovGateway(uint64(len(v))) + } + mapEntrySize := 1 + len(k) + sovGateway(uint64(len(k))) + l + n += mapEntrySize + 1 + sovGateway(uint64(mapEntrySize)) + } + } + if m.Ref != nil { + l = m.Ref.Size() n += 1 + l + sovGateway(uint64(l)) } l = len(m.Path) @@ -7635,9 +7682,9 @@ func (m *Attestation) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGateway @@ -7647,25 +7694,157 @@ func (m *Attestation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGateway } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGateway } if postIndex > l { return io.ErrUnexpectedEOF } - m.Ref = string(dAtA[iNdEx:postIndex]) + if m.Metadata == nil { + m.Metadata = make(map[string][]byte) + } + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGateway + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGateway + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthGateway + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthGateway + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGateway(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGateway + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Metadata[mapkey] = mapvalue iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGateway + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Ref == nil { + m.Ref = &Ref{} + } + if err := m.Ref.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) } @@ -7697,7 +7876,7 @@ func (m *Attestation) Unmarshal(dAtA []byte) error { } m.Path = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InTotoPredicateType", wireType) } @@ -7729,7 +7908,7 @@ func (m *Attestation) Unmarshal(dAtA []byte) error { } m.InTotoPredicateType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InTotoSubjects", wireType) } diff --git a/frontend/gateway/pb/gateway.proto b/frontend/gateway/pb/gateway.proto index 3fa0d00d7341..7bc1520e5ec5 100644 --- a/frontend/gateway/pb/gateway.proto +++ b/frontend/gateway/pb/gateway.proto @@ -72,11 +72,12 @@ message Attestations { message Attestation { AttestationKind kind = 1; + map metadata = 2; - string ref = 2; - string path = 3; - string inTotoPredicateType = 4; - repeated InTotoSubject inTotoSubjects = 5; + Ref ref = 3; + string path = 4; + string inTotoPredicateType = 5; + repeated InTotoSubject inTotoSubjects = 6; } enum AttestationKind { diff --git a/solver/llbsolver/proc/provenance.go b/solver/llbsolver/proc/provenance.go index d5448a18a96e..379847c41522 100644 --- a/solver/llbsolver/proc/provenance.go +++ b/solver/llbsolver/proc/provenance.go @@ -27,20 +27,9 @@ import ( func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor { return func(ctx context.Context, res *llbsolver.Result, s *llbsolver.Solver, j *solver.Job) (*llbsolver.Result, error) { - if len(res.Refs) == 0 { - return nil, errors.New("provided result has no refs") - } - - platformsBytes, ok := res.Metadata[exptypes.ExporterPlatformsKey] - if !ok { - return nil, errors.Errorf("unable to collect multiple refs, missing platforms mapping") - } - - var ps exptypes.Platforms - if len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &ps); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to provenance processor") - } + ps, err := exptypes.ParsePlatforms(res.Metadata) + if err != nil { + return nil, err } buildID := identity.NewID() @@ -72,7 +61,7 @@ func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor { } for _, p := range ps.Platforms { - cp, ok := res.Provenance.Refs[p.ID] + cp, ok := res.Provenance.FindRef(p.ID) if !ok { return nil, errors.New("no build info found for provenance") } @@ -104,12 +93,16 @@ func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor { pr.Invocation.Parameters.Secrets = nil pr.Invocation.Parameters.SSH = nil case "max": - dgsts, err := provenance.AddBuildConfig(ctx, pr, res.Refs[p.ID]) + ref, ok := res.FindRef(p.ID) + if !ok { + return nil, errors.Errorf("could not find ref %s", p.ID) + } + dgsts, err := provenance.AddBuildConfig(ctx, pr, ref) if err != nil { return nil, err } - r, err := res.Refs[p.ID].Result(ctx) + r, err := ref.Result(ctx) if err != nil { return nil, err } @@ -149,7 +142,7 @@ func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor { return nil, errors.Errorf("invalid mode %q", mode) } - res.AddAttestation(p.ID, result.Attestation{ + res.AddAttestation(p.ID, llbsolver.Attestation{ Kind: gatewaypb.AttestationKindInToto, Metadata: map[string][]byte{ result.AttestationReasonKey: result.AttestationReasonProvenance, @@ -172,7 +165,7 @@ func ProvenanceProcessor(attrs map[string]string) llbsolver.Processor { // TODO: pass indent to json.Marshal return json.MarshalIndent(pr, "", " ") }, - }, nil) + }) } return res, nil diff --git a/solver/llbsolver/proc/refs.go b/solver/llbsolver/proc/refs.go deleted file mode 100644 index 96ffa211c1f1..000000000000 --- a/solver/llbsolver/proc/refs.go +++ /dev/null @@ -1,81 +0,0 @@ -package proc - -import ( - "context" - "encoding/json" - "errors" - "fmt" - - "github.com/containerd/containerd/platforms" - "github.com/moby/buildkit/exporter/containerimage/exptypes" - "github.com/moby/buildkit/solver" - "github.com/moby/buildkit/solver/llbsolver" - "github.com/moby/buildkit/solver/llbsolver/provenance" - ocispecs "github.com/opencontainers/image-spec/specs-go/v1" -) - -// ForceRefsProcessor is a processor that forces a result made of a single Ref -// into the Refs map, correctly creating and converting relevant metadata. -// -// This is useful for cases where a frontend produces a single-platform image, -// but we need to add additional Refs to it (e.g. attestations). -func ForceRefsProcessor(ctx context.Context, result *llbsolver.Result, s *llbsolver.Solver, j *solver.Job) (*llbsolver.Result, error) { - if len(result.Refs) > 0 { - return result, nil - } - if result.Ref == nil { - return nil, errors.New("no refs to operate on") - } - - // try to determine platform from image config, fallback to current platform - p := platforms.DefaultSpec() - if imgConfig, ok := result.Metadata[exptypes.ExporterImageConfigKey]; ok { - var img ocispecs.Image - err := json.Unmarshal(imgConfig, &img) - if err != nil { - return nil, err - } - - if img.OS != "" && img.Architecture != "" { - p = ocispecs.Platform{ - Architecture: img.Architecture, - OS: img.OS, - OSVersion: img.OSVersion, - OSFeatures: img.OSFeatures, - Variant: img.Variant, - } - } - } - p = platforms.Normalize(p) - pk := platforms.Format(p) - - result.Refs = map[string]solver.ResultProxy{ - pk: result.Ref, - } - result.Ref = nil - - if result.Metadata != nil { - for _, key := range exptypes.KnownRefMetadataKeys { - if value, ok := result.Metadata[key]; ok { - result.Metadata[fmt.Sprintf("%s/%s", key, pk)] = value - delete(result.Metadata, key) - } - } - } - - expPlatforms := exptypes.Platforms{ - Platforms: []exptypes.Platform{{ID: pk, Platform: p}}, - } - dt, err := json.Marshal(expPlatforms) - if err != nil { - return nil, err - } - result.AddMeta(exptypes.ExporterPlatformsKey, dt) - - result.Provenance.Refs = map[string]*provenance.Capture{ - pk: result.Provenance.Ref, - } - result.Provenance.Ref = nil - - return result, nil -} diff --git a/solver/llbsolver/proc/sbom.go b/solver/llbsolver/proc/sbom.go index 2643714ad217..dd68ef9b6dcf 100644 --- a/solver/llbsolver/proc/sbom.go +++ b/solver/llbsolver/proc/sbom.go @@ -2,7 +2,6 @@ package proc import ( "context" - "encoding/json" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" @@ -10,6 +9,7 @@ import ( "github.com/moby/buildkit/frontend/attestations/sbom" "github.com/moby/buildkit/solver" "github.com/moby/buildkit/solver/llbsolver" + "github.com/moby/buildkit/solver/result" "github.com/pkg/errors" ) @@ -20,16 +20,9 @@ func SBOMProcessor(scannerRef string) llbsolver.Processor { return res, nil } - platformsBytes, ok := res.Metadata[exptypes.ExporterPlatformsKey] - if !ok { - return nil, errors.Errorf("unable to collect multiple refs, missing platforms mapping") - } - - var ps exptypes.Platforms - if len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &ps); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to sbom processor") - } + ps, err := exptypes.ParsePlatforms(res.Metadata) + if err != nil { + return nil, err } scanner, err := sbom.CreateSBOMScanner(ctx, s.Bridge(j), scannerRef) @@ -41,7 +34,7 @@ func SBOMProcessor(scannerRef string) llbsolver.Processor { } for _, p := range ps.Platforms { - ref, ok := res.Refs[p.ID] + ref, ok := res.FindRef(p.ID) if !ok { return nil, errors.Errorf("could not find ref %s", p.ID) } @@ -51,23 +44,28 @@ func SBOMProcessor(scannerRef string) llbsolver.Processor { } st := llb.NewState(defop) - att, st, err := scanner(ctx, p.ID, st, nil) - if err != nil { - return nil, err - } - - def, err := st.Marshal(ctx) + att, err := scanner(ctx, p.ID, st, nil) if err != nil { return nil, err } + attSolve, err := result.ConvertAttestation(&att, func(st llb.State) (solver.ResultProxy, error) { + def, err := st.Marshal(ctx) + if err != nil { + return nil, err + } - r, err := s.Bridge(j).Solve(ctx, frontend.SolveRequest{ // TODO: buildinfo - Definition: def.ToPB(), - }, j.SessionID) + r, err := s.Bridge(j).Solve(ctx, frontend.SolveRequest{ // TODO: buildinfo + Definition: def.ToPB(), + }, j.SessionID) + if err != nil { + return nil, err + } + return r.Ref, nil + }) if err != nil { return nil, err } - res.AddAttestation(p.ID, att, r.Ref) + res.AddAttestation(p.ID, *attSolve) } return res, nil } diff --git a/solver/llbsolver/provenance.go b/solver/llbsolver/provenance.go index 923703021cdf..4ddd4a4dbea6 100644 --- a/solver/llbsolver/provenance.go +++ b/solver/llbsolver/provenance.go @@ -2,7 +2,6 @@ package llbsolver import ( "context" - "encoding/json" "sync" "github.com/containerd/containerd/platforms" @@ -59,7 +58,10 @@ func (b *provenanceBridge) allImages() []provenance.ImageSource { } func (b *provenanceBridge) requests(r *frontend.Result) (*resultRequests, error) { - reqs := &resultRequests{refs: make(map[string]*resultWithBridge)} + reqs := &resultRequests{ + refs: make(map[string]*resultWithBridge), + atts: make(map[string][]*resultWithBridge), + } if r.Ref != nil { ref, ok := b.findByResult(r.Ref) @@ -77,16 +79,25 @@ func (b *provenanceBridge) requests(r *frontend.Result) (*resultRequests, error) reqs.refs[k] = r } - if platformsBytes, ok := r.Metadata[exptypes.ExporterPlatformsKey]; ok { - var ps exptypes.Platforms - if len(platformsBytes) > 0 { - if err := json.Unmarshal(platformsBytes, &ps); err != nil { - return nil, errors.Wrapf(err, "failed to parse platforms passed to provenance processor") + for k, atts := range r.Attestations { + for _, att := range atts { + if att.Ref == nil { + continue + } + r, ok := b.findByResult(att.Ref) + if !ok { + return nil, errors.Errorf("could not find request for ref %s", att.Ref.ID()) } - reqs.platforms = ps.Platforms + reqs.atts[k] = append(reqs.atts[k], r) } } + ps, err := exptypes.ParsePlatforms(r.Metadata) + if err != nil { + return nil, err + } + reqs.platforms = ps.Platforms + return reqs, nil } @@ -97,15 +108,15 @@ func (b *provenanceBridge) findByResult(rp solver.ResultProxy) (*resultWithBridg } } for _, bld := range b.builds { - if bld.res.Ref != nil { - if bld.res.Ref.ID() == rp.ID() { - return &bld, true - } - } - for _, ref := range bld.res.Refs { - if ref.ID() == rp.ID() { - return &bld, true + found := false + bld.res.EachRef(func(r solver.ResultProxy) error { + if r.ID() == rp.ID() { + found = true } + return nil + }) + if found { + return &bld, true } } return nil, false @@ -165,6 +176,7 @@ func (b *provenanceBridge) Solve(ctx context.Context, req frontend.SolveRequest, type resultRequests struct { ref *resultWithBridge refs map[string]*resultWithBridge + atts map[string][]*resultWithBridge platforms []exptypes.Platform } @@ -228,6 +240,11 @@ func (reqs *resultRequests) allRes() map[string]struct{} { for _, r := range reqs.refs { res[r.res.Ref.ID()] = struct{}{} } + for _, rs := range reqs.atts { + for _, r := range rs { + res[r.res.Ref.ID()] = struct{}{} + } + } return res } diff --git a/solver/llbsolver/provenance/capture.go b/solver/llbsolver/provenance/capture.go index 3d94e8f5c2f3..a176e9875faa 100644 --- a/solver/llbsolver/provenance/capture.go +++ b/solver/llbsolver/provenance/capture.go @@ -4,14 +4,12 @@ import ( "sort" distreference "github.com/docker/distribution/reference" + "github.com/moby/buildkit/solver/result" digest "github.com/opencontainers/go-digest" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ) -type Result struct { - Ref *Capture - Refs map[string]*Capture -} +type Result = result.Result[*Capture] type ImageSource struct { Ref string diff --git a/solver/llbsolver/result.go b/solver/llbsolver/result.go index 7cd08754ae84..718b1b09d301 100644 --- a/solver/llbsolver/result.go +++ b/solver/llbsolver/result.go @@ -17,6 +17,8 @@ type Result struct { Provenance *provenance.Result } +type Attestation = frontend.Attestation + func workerRefResolver(refCfg cacheconfig.RefConfig, all bool, g session.Group) func(ctx context.Context, res solver.Result) ([]*solver.Remote, error) { return func(ctx context.Context, res solver.Result) ([]*solver.Remote, error) { ref, ok := res.Sys().(*worker.WorkerRef) diff --git a/solver/llbsolver/solver.go b/solver/llbsolver/solver.go index 950e5233f323..1a4e803cb1cf 100644 --- a/solver/llbsolver/solver.go +++ b/solver/llbsolver/solver.go @@ -412,6 +412,7 @@ func addProvenanceToResult(res *frontend.Result, br *provenanceBridge) (*Result, Result: res, Provenance: &provenance.Result{}, } + if res.Ref != nil { cp, err := getProvenance(res.Ref, reqs.ref.bridge, "", reqs) if err != nil { @@ -425,11 +426,10 @@ func addProvenanceToResult(res *frontend.Result, br *provenanceBridge) (*Result, return nil, err } } - if len(res.Refs) == 0 { - return out, nil - } - out.Provenance.Refs = make(map[string]*provenance.Capture, len(res.Refs)) + if len(res.Refs) != 0 { + out.Provenance.Refs = make(map[string]*provenance.Capture, len(res.Refs)) + } for k, ref := range res.Refs { cp, err := getProvenance(ref, reqs.refs[k].bridge, k, reqs) if err != nil { @@ -443,6 +443,22 @@ func addProvenanceToResult(res *frontend.Result, br *provenanceBridge) (*Result, return nil, err } } + + if len(res.Attestations) != 0 { + out.Provenance.Attestations = make(map[string][]result.Attestation[*provenance.Capture], len(res.Attestations)) + } + for k, as := range res.Attestations { + for i, a := range as { + a2, err := result.ConvertAttestation(&a, func(r solver.ResultProxy) (*provenance.Capture, error) { + return getProvenance(r, reqs.atts[k][i].bridge, k, reqs) + }) + if err != nil { + return nil, err + } + out.Provenance.Attestations[k] = append(out.Provenance.Attestations[k], *a2) + } + } + return out, nil } @@ -460,6 +476,10 @@ func getRefProvenance(ref solver.ResultProxy, br *provenanceBridge) (*provenance } if br.req != nil { + if pr == nil { + return nil, errors.Errorf("missing provenance for %s", ref.ID()) + } + pr.Frontend = br.req.Frontend pr.Args = provenance.FilterArgs(br.req.FrontendOpt) // TODO: should also save some output options like compression diff --git a/solver/result/attestation.go b/solver/result/attestation.go index e23e88ab3d18..6fa8403db67c 100644 --- a/solver/result/attestation.go +++ b/solver/result/attestation.go @@ -1,6 +1,8 @@ package result import ( + "reflect" + pb "github.com/moby/buildkit/frontend/gateway/pb" digest "github.com/opencontainers/go-digest" ) @@ -15,12 +17,12 @@ var ( AttestationReasonProvenance = []byte("provenance") ) -type Attestation struct { +type Attestation[T any] struct { Kind pb.AttestationKind Metadata map[string][]byte - Ref string + Ref T Path string ContentFunc func() ([]byte, error) @@ -54,3 +56,23 @@ func FromDigestMap(m map[string]string) []digest.Digest { } return ds } + +func ConvertAttestation[U any, V any](a *Attestation[U], fn func(U) (V, error)) (*Attestation[V], error) { + var ref V + if reflect.ValueOf(a.Ref).IsValid() { + var err error + ref, err = fn(a.Ref) + if err != nil { + return nil, err + } + } + + return &Attestation[V]{ + Kind: a.Kind, + Metadata: a.Metadata, + Ref: ref, + Path: a.Path, + ContentFunc: a.ContentFunc, + InToto: a.InToto, + }, nil +} diff --git a/solver/result/result.go b/solver/result/result.go index 24ffe5153a1f..d5fe2d03cfcd 100644 --- a/solver/result/result.go +++ b/solver/result/result.go @@ -2,23 +2,17 @@ package result import ( "reflect" - "strings" "sync" - "github.com/moby/buildkit/identity" "github.com/pkg/errors" ) -const ( - attestationRefPrefix = "attestation:" -) - type Result[T any] struct { mu sync.Mutex Ref T Refs map[string]T Metadata map[string][]byte - Attestations map[string][]Attestation + Attestations map[string][]Attestation[T] } func (r *Result[T]) AddMeta(k string, v []byte) { @@ -39,19 +33,10 @@ func (r *Result[T]) AddRef(k string, ref T) { r.mu.Unlock() } -func (r *Result[T]) AddAttestation(k string, v Attestation, ref T) { +func (r *Result[T]) AddAttestation(k string, v Attestation[T]) { r.mu.Lock() - if reflect.ValueOf(ref).IsValid() { - if r.Refs == nil { - r.Refs = map[string]T{} - } - if !strings.HasPrefix(v.Ref, attestationRefPrefix) { - v.Ref = attestationRefPrefix + identity.NewID() - r.Refs[v.Ref] = ref - } - } if r.Attestations == nil { - r.Attestations = map[string][]Attestation{} + r.Attestations = map[string][]Attestation[T]{} } r.Attestations[k] = append(r.Attestations[k], v) r.mu.Unlock() @@ -72,6 +57,25 @@ func (r *Result[T]) SingleRef() (T, error) { return r.Ref, nil } +func (r *Result[T]) FindRef(key string) (T, bool) { + r.mu.Lock() + defer r.mu.Unlock() + + if r.Refs != nil { + if ref, ok := r.Refs[key]; ok { + return ref, true + } + if len(r.Refs) == 1 { + for _, ref := range r.Refs { + return ref, true + } + } + var t T + return t, false + } + return r.Ref, true +} + func (r *Result[T]) EachRef(fn func(T) error) (err error) { if reflect.ValueOf(r.Ref).IsValid() { err = fn(r.Ref) @@ -83,6 +87,15 @@ func (r *Result[T]) EachRef(fn func(T) error) (err error) { } } } + for _, as := range r.Attestations { + for _, a := range as { + if reflect.ValueOf(a.Ref).IsValid() { + if err1 := fn(a.Ref); err1 != nil && err == nil { + err = err1 + } + } + } + } return err } @@ -94,12 +107,33 @@ func EachRef[U any, V any](a *Result[U], b *Result[V], fn func(U, V) error) (err err = fn(a.Ref, b.Ref) } for k, r := range a.Refs { - if reflect.ValueOf(r).IsValid() && reflect.ValueOf(b.Refs[k]).IsValid() { - if err1 := fn(r, b.Refs[k]); err1 != nil && err == nil { + r2, ok := b.Refs[k] + if !ok { + continue + } + if reflect.ValueOf(r).IsValid() && reflect.ValueOf(r2).IsValid() { + if err1 := fn(r, r2); err1 != nil && err == nil { err = err1 } } } + for k, atts := range a.Attestations { + atts2, ok := b.Attestations[k] + if !ok { + continue + } + for i, att := range atts { + if i >= len(atts2) { + break + } + att2 := atts2[i] + if reflect.ValueOf(att.Ref).IsValid() && reflect.ValueOf(att2.Ref).IsValid() { + if err1 := fn(att.Ref, att2.Ref); err1 != nil && err == nil { + err = err1 + } + } + } + } return err } @@ -118,15 +152,28 @@ func ConvertResult[U any, V any](r *Result[U], fn func(U) (V, error)) (*Result[V r2.Refs = map[string]V{} } for k, r := range r.Refs { - if reflect.ValueOf(r).IsValid() { - r2.Refs[k], err = fn(r) + if !reflect.ValueOf(r).IsValid() { + continue + } + r2.Refs[k], err = fn(r) + if err != nil { + return nil, err + } + } + + if r.Attestations != nil { + r2.Attestations = map[string][]Attestation[V]{} + } + for k, as := range r.Attestations { + for _, a := range as { + a2, err := ConvertAttestation(&a, fn) if err != nil { return nil, err } + r2.Attestations[k] = append(r2.Attestations[k], *a2) } } - r2.Attestations = r.Attestations r2.Metadata = r.Metadata return r2, nil