mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to 93b40706a007
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
26
vendor/github.com/moby/buildkit/solver/result/attestation.go
generated
vendored
26
vendor/github.com/moby/buildkit/solver/result/attestation.go
generated
vendored
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user