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:
24
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
24
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
@ -56,6 +56,10 @@ type subAction interface {
|
||||
toProtoAction(context.Context, string, pb.InputIndex) (pb.IsFileAction, error)
|
||||
}
|
||||
|
||||
type capAdder interface {
|
||||
addCaps(*FileOp)
|
||||
}
|
||||
|
||||
type FileAction struct {
|
||||
state *State
|
||||
prev *FileAction
|
||||
@ -427,6 +431,8 @@ type CopyInfo struct {
|
||||
Mode *os.FileMode
|
||||
FollowSymlinks bool
|
||||
CopyDirContentsOnly bool
|
||||
IncludePatterns []string
|
||||
ExcludePatterns []string
|
||||
AttemptUnpack bool
|
||||
CreateDestPath bool
|
||||
AllowWildcard bool
|
||||
@ -458,6 +464,8 @@ func (a *fileActionCopy) toProtoAction(ctx context.Context, parent string, base
|
||||
Src: src,
|
||||
Dest: normalizePath(parent, a.dest, true),
|
||||
Owner: a.info.ChownOpt.marshal(base),
|
||||
IncludePatterns: a.info.IncludePatterns,
|
||||
ExcludePatterns: a.info.ExcludePatterns,
|
||||
AllowWildcard: a.info.AllowWildcard,
|
||||
AllowEmptyWildcard: a.info.AllowEmptyWildcard,
|
||||
FollowSymlink: a.info.FollowSymlinks,
|
||||
@ -496,6 +504,12 @@ func (a *fileActionCopy) sourcePath(ctx context.Context) (string, error) {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (a *fileActionCopy) addCaps(f *FileOp) {
|
||||
if len(a.info.IncludePatterns) != 0 || len(a.info.ExcludePatterns) != 0 {
|
||||
addCap(&f.constraints, pb.CapFileCopyIncludeExcludePatterns)
|
||||
}
|
||||
}
|
||||
|
||||
type CreatedTime time.Time
|
||||
|
||||
func WithCreatedTime(t time.Time) CreatedTime {
|
||||
@ -530,7 +544,7 @@ type FileOp struct {
|
||||
isValidated bool
|
||||
}
|
||||
|
||||
func (f *FileOp) Validate(context.Context) error {
|
||||
func (f *FileOp) Validate(context.Context, *Constraints) error {
|
||||
if f.isValidated {
|
||||
return nil
|
||||
}
|
||||
@ -653,7 +667,7 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
if f.Cached(c) {
|
||||
return f.Load()
|
||||
}
|
||||
if err := f.Validate(ctx); err != nil {
|
||||
if err := f.Validate(ctx, c); err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
|
||||
@ -662,7 +676,7 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
pfo := &pb.FileOp{}
|
||||
|
||||
if f.constraints.Platform == nil {
|
||||
p, err := getPlatform(*f.action.state)(ctx)
|
||||
p, err := getPlatform(*f.action.state)(ctx, c)
|
||||
if err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
@ -682,6 +696,10 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
pop.Inputs = state.inputs
|
||||
|
||||
for i, st := range state.actions {
|
||||
if adder, isCapAdder := st.action.(capAdder); isCapAdder {
|
||||
adder.addCaps(f)
|
||||
}
|
||||
|
||||
output := pb.OutputIndex(-1)
|
||||
if i+1 == len(state.actions) {
|
||||
output = 0
|
||||
|
Reference in New Issue
Block a user