mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to opentelemetry support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
53
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
53
vendor/github.com/moby/buildkit/client/llb/source.go
generated
vendored
@ -36,7 +36,7 @@ func NewSource(id string, attrs map[string]string, c Constraints) *SourceOp {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *SourceOp) Validate(ctx context.Context) error {
|
||||
func (s *SourceOp) Validate(ctx context.Context, c *Constraints) error {
|
||||
if s.err != nil {
|
||||
return s.err
|
||||
}
|
||||
@ -50,7 +50,7 @@ func (s *SourceOp) Marshal(ctx context.Context, constraints *Constraints) (diges
|
||||
if s.Cached(constraints) {
|
||||
return s.Load()
|
||||
}
|
||||
if err := s.Validate(ctx); err != nil {
|
||||
if err := s.Validate(ctx, constraints); err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
|
||||
@ -121,9 +121,13 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
src.err = err
|
||||
} else if info.metaResolver != nil {
|
||||
if _, ok := r.(reference.Digested); ok || !info.resolveDigest {
|
||||
return NewState(src.Output()).Async(func(ctx context.Context, st State) (State, error) {
|
||||
return NewState(src.Output()).Async(func(ctx context.Context, st State, c *Constraints) (State, error) {
|
||||
p := info.Constraints.Platform
|
||||
if p == nil {
|
||||
p = c.Platform
|
||||
}
|
||||
_, dt, err := info.metaResolver.ResolveImageConfig(ctx, ref, ResolveImageConfigOpt{
|
||||
Platform: info.Constraints.Platform,
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
})
|
||||
if err != nil {
|
||||
@ -132,9 +136,13 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
return st.WithImageConfig(dt)
|
||||
})
|
||||
}
|
||||
return Scratch().Async(func(ctx context.Context, _ State) (State, error) {
|
||||
return Scratch().Async(func(ctx context.Context, _ State, c *Constraints) (State, error) {
|
||||
p := info.Constraints.Platform
|
||||
if p == nil {
|
||||
p = c.Platform
|
||||
}
|
||||
dgst, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, ResolveImageConfigOpt{
|
||||
Platform: info.Constraints.Platform,
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
})
|
||||
if err != nil {
|
||||
@ -361,6 +369,12 @@ func Local(name string, opts ...LocalOption) State {
|
||||
attrs[pb.AttrSharedKeyHint] = gi.SharedKeyHint
|
||||
addCap(&gi.Constraints, pb.CapSourceLocalSharedKeyHint)
|
||||
}
|
||||
if gi.Differ.Type != "" {
|
||||
attrs[pb.AttrLocalDiffer] = string(gi.Differ.Type)
|
||||
if gi.Differ.Required {
|
||||
addCap(&gi.Constraints, pb.CapSourceLocalDiffer)
|
||||
}
|
||||
}
|
||||
|
||||
addCap(&gi.Constraints, pb.CapSourceLocal)
|
||||
|
||||
@ -423,6 +437,32 @@ func SharedKeyHint(h string) LocalOption {
|
||||
})
|
||||
}
|
||||
|
||||
func Differ(t DiffType, required bool) LocalOption {
|
||||
return localOptionFunc(func(li *LocalInfo) {
|
||||
li.Differ = DifferInfo{
|
||||
Type: t,
|
||||
Required: required,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
type DiffType string
|
||||
|
||||
const (
|
||||
// DiffNone will do no file comparisons, all files in the Local source will
|
||||
// be retransmitted.
|
||||
DiffNone DiffType = pb.AttrLocalDifferNone
|
||||
// DiffMetadata will compare file metadata (size, modified time, mode, owner,
|
||||
// group, device and link name) to determine if the files in the Local source need
|
||||
// to be retransmitted. This is the default behavior.
|
||||
DiffMetadata DiffType = pb.AttrLocalDifferMetadata
|
||||
)
|
||||
|
||||
type DifferInfo struct {
|
||||
Type DiffType
|
||||
Required bool
|
||||
}
|
||||
|
||||
type LocalInfo struct {
|
||||
constraintsWrapper
|
||||
SessionID string
|
||||
@ -430,6 +470,7 @@ type LocalInfo struct {
|
||||
ExcludePatterns string
|
||||
FollowPaths string
|
||||
SharedKeyHint string
|
||||
Differ DifferInfo
|
||||
}
|
||||
|
||||
func HTTP(url string, opts ...HTTPOption) State {
|
||||
|
Reference in New Issue
Block a user