vendor: github.com/moby/buildkit 6bd81372ad6f (master)

- tests: implement NetNSDetached method

full diff: 6e200afad5...6bd81372ad

Co-authored-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-01-18 00:46:45 +01:00
parent 528e3ba259
commit dbaad32f49
32 changed files with 945 additions and 351 deletions

View File

@ -14,7 +14,7 @@ func IsCanceled(ctx context.Context, err error) bool {
return true
}
// grpc does not set cancel correctly when stream gets cancelled and then Recv is called
if err != nil && context.Cause(ctx) == context.Canceled {
if err != nil && errors.Is(context.Cause(ctx), context.Canceled) {
// when this error comes from containerd it is not typed at all, just concatenated string
if strings.Contains(err.Error(), "EOF") {
return true

View File

@ -85,6 +85,8 @@ const (
// CapSourceDateEpoch is the capability to automatically handle the date epoch
CapSourceDateEpoch apicaps.CapID = "exporter.sourcedateepoch"
CapMultipleExporters apicaps.CapID = "exporter.multiple"
CapSourcePolicy apicaps.CapID = "source.policy"
)
@ -454,6 +456,12 @@ func init() {
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapMultipleExporters,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapSourcePolicy,
Enabled: true,

View File

@ -1,6 +1,7 @@
package result
import (
"maps"
"sync"
"github.com/pkg/errors"
@ -14,6 +15,15 @@ type Result[T comparable] struct {
Attestations map[string][]Attestation[T]
}
func (r *Result[T]) Clone() *Result[T] {
return &Result[T]{
Ref: r.Ref,
Refs: maps.Clone(r.Refs),
Metadata: maps.Clone(r.Metadata),
Attestations: maps.Clone(r.Attestations),
}
}
func (r *Result[T]) AddMeta(k string, v []byte) {
r.mu.Lock()
if r.Metadata == nil {
@ -142,6 +152,10 @@ func EachRef[U comparable, V comparable](a *Result[U], b *Result[V], fn func(U,
return err
}
// ConvertResult transforms a Result[U] into a Result[V], using a transfomer
// function that converts a U to a V. Zero values of type U are converted to
// zero values of type V directly, without passing through the transformer
// function.
func ConvertResult[U comparable, V comparable](r *Result[U], fn func(U) (V, error)) (*Result[V], error) {
var zero U
@ -160,6 +174,8 @@ func ConvertResult[U comparable, V comparable](r *Result[U], fn func(U) (V, erro
}
for k, r := range r.Refs {
if r == zero {
var zero V
r2.Refs[k] = zero
continue
}
r2.Refs[k], err = fn(r)