diff --git a/build/build.go b/build/build.go index a0e2974d..34d69345 100644 --- a/build/build.go +++ b/build/build.go @@ -37,7 +37,6 @@ import ( "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/exporter/containerimage/exptypes" - "github.com/moby/buildkit/frontend/attestations" gateway "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/upload/uploadprovider" @@ -1113,11 +1112,13 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s req := gateway.SolveRequest{ Frontend: so.Frontend, - FrontendOpt: so.FrontendAttrs, FrontendInputs: frontendInputs, + FrontendOpt: make(map[string]string), + } + for k, v := range so.FrontendAttrs { + req.FrontendOpt[k] = v } so.Frontend = "" - so.FrontendAttrs = attestations.Filter(so.FrontendAttrs) so.FrontendInputs = nil ch, done := progress.NewChannel(pw) diff --git a/vendor/github.com/moby/buildkit/frontend/attestations/parse.go b/vendor/github.com/moby/buildkit/frontend/attestations/parse.go deleted file mode 100644 index 00de649f..00000000 --- a/vendor/github.com/moby/buildkit/frontend/attestations/parse.go +++ /dev/null @@ -1,81 +0,0 @@ -package attestations - -import ( - "encoding/csv" - "strings" - - "github.com/pkg/errors" -) - -const ( - KeyTypeSbom = "sbom" - KeyTypeProvenance = "provenance" -) - -const ( - defaultSBOMGenerator = "docker/buildkit-syft-scanner:stable-1" -) - -func Filter(v map[string]string) map[string]string { - attests := make(map[string]string) - for k, v := range v { - if strings.HasPrefix(k, "attest:") { - attests[k] = v - continue - } - if strings.HasPrefix(k, "build-arg:BUILDKIT_ATTEST_") { - attests[k] = v - continue - } - } - return attests -} - -func Validate(values map[string]map[string]string) (map[string]map[string]string, error) { - for k := range values { - if k != KeyTypeSbom && k != KeyTypeProvenance { - return nil, errors.Errorf("unknown attestation type %q", k) - } - } - return values, nil -} - -func Parse(values map[string]string) (map[string]map[string]string, error) { - attests := make(map[string]string) - for k, v := range values { - if strings.HasPrefix(k, "attest:") { - attests[strings.ToLower(strings.TrimPrefix(k, "attest:"))] = v - continue - } - if strings.HasPrefix(k, "build-arg:BUILDKIT_ATTEST_") { - attests[strings.ToLower(strings.TrimPrefix(k, "build-arg:BUILDKIT_ATTEST_"))] = v - continue - } - } - - out := make(map[string]map[string]string) - for k, v := range attests { - attrs := make(map[string]string) - out[k] = attrs - if k == KeyTypeSbom { - attrs["generator"] = defaultSBOMGenerator - } - if v == "" { - continue - } - csvReader := csv.NewReader(strings.NewReader(v)) - fields, err := csvReader.Read() - if err != nil { - return nil, errors.Wrapf(err, "failed to parse %s", k) - } - for _, field := range fields { - parts := strings.SplitN(field, "=", 2) - if len(parts) != 2 { - parts = append(parts, "") - } - attrs[parts[0]] = parts[1] - } - } - - return Validate(out) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index a67671f2..6afe6ef9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -448,7 +448,6 @@ github.com/moby/buildkit/client/ociindex github.com/moby/buildkit/cmd/buildkitd/config github.com/moby/buildkit/exporter/containerimage/exptypes github.com/moby/buildkit/exporter/containerimage/image -github.com/moby/buildkit/frontend/attestations github.com/moby/buildkit/frontend/gateway/client github.com/moby/buildkit/frontend/gateway/grpcclient github.com/moby/buildkit/frontend/gateway/pb