mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-25 13:17:45 +08:00
build: add attestations to build options
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
f8b673eccd
commit
f0262dd10e
@ -37,6 +37,7 @@ import (
|
|||||||
"github.com/moby/buildkit/client"
|
"github.com/moby/buildkit/client"
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
|
"github.com/moby/buildkit/frontend/attestations"
|
||||||
gateway "github.com/moby/buildkit/frontend/gateway/client"
|
gateway "github.com/moby/buildkit/frontend/gateway/client"
|
||||||
"github.com/moby/buildkit/session"
|
"github.com/moby/buildkit/session"
|
||||||
"github.com/moby/buildkit/session/upload/uploadprovider"
|
"github.com/moby/buildkit/session/upload/uploadprovider"
|
||||||
@ -67,6 +68,7 @@ type Options struct {
|
|||||||
Inputs Inputs
|
Inputs Inputs
|
||||||
|
|
||||||
Allow []entitlements.Entitlement
|
Allow []entitlements.Entitlement
|
||||||
|
Attests map[string]*string
|
||||||
BuildArgs map[string]string
|
BuildArgs map[string]string
|
||||||
CacheFrom []client.CacheOptionsEntry
|
CacheFrom []client.CacheOptionsEntry
|
||||||
CacheTo []client.CacheOptionsEntry
|
CacheTo []client.CacheOptionsEntry
|
||||||
@ -578,6 +580,21 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(opt.Attests) > 0 {
|
||||||
|
if !bopts.LLBCaps.Contains(apicaps.CapID("exporter.image.attestations")) {
|
||||||
|
return nil, nil, errors.Errorf("attestations are not supported by the current buildkitd")
|
||||||
|
}
|
||||||
|
for k, v := range opt.Attests {
|
||||||
|
if v == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
so.FrontendAttrs[k] = *v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := opt.Attests["attest:provenance"]; !ok {
|
||||||
|
so.FrontendAttrs["attest:provenance"] = "mode=min,inline-only=true"
|
||||||
|
}
|
||||||
|
|
||||||
// set platforms
|
// set platforms
|
||||||
if len(opt.Platforms) != 0 {
|
if len(opt.Platforms) != 0 {
|
||||||
pp := make([]string, len(opt.Platforms))
|
pp := make([]string, len(opt.Platforms))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user