mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit and dockerd
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
33
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
33
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
@ -20,6 +20,7 @@ type Meta struct {
|
||||
ProxyEnv *ProxyEnv
|
||||
ExtraHosts []HostIP
|
||||
Network pb.NetMode
|
||||
Security pb.SecurityMode
|
||||
}
|
||||
|
||||
func NewExecOp(root Output, meta Meta, readOnly bool, c Constraints) *ExecOp {
|
||||
@ -52,7 +53,7 @@ type mount struct {
|
||||
cacheID string
|
||||
tmpfs bool
|
||||
cacheSharing CacheMountSharingMode
|
||||
// hasOutput bool
|
||||
noOutput bool
|
||||
}
|
||||
|
||||
type ExecOp struct {
|
||||
@ -79,6 +80,8 @@ func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Outp
|
||||
m.output = source
|
||||
} else if m.tmpfs {
|
||||
m.output = &output{vertex: e, err: errors.Errorf("tmpfs mount for %s can't be used as a parent", target)}
|
||||
} else if m.noOutput {
|
||||
m.output = &output{vertex: e, err: errors.Errorf("mount marked no-output and %s can't be used as a parent", target)}
|
||||
} else {
|
||||
o := &output{vertex: e, getIndex: e.getMountIndexFn(m)}
|
||||
if p := e.constraints.Platform; p != nil {
|
||||
@ -166,13 +169,18 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata,
|
||||
}
|
||||
|
||||
peo := &pb.ExecOp{
|
||||
Meta: meta,
|
||||
Network: e.meta.Network,
|
||||
Meta: meta,
|
||||
Network: e.meta.Network,
|
||||
Security: e.meta.Security,
|
||||
}
|
||||
if e.meta.Network != NetModeSandbox {
|
||||
addCap(&e.constraints, pb.CapExecMetaNetwork)
|
||||
}
|
||||
|
||||
if e.meta.Security != SecurityModeInsecure {
|
||||
addCap(&e.constraints, pb.CapExecMetaSecurity)
|
||||
}
|
||||
|
||||
if p := e.meta.ProxyEnv; p != nil {
|
||||
peo.Meta.ProxyEnv = &pb.ProxyEnv{
|
||||
HttpProxy: p.HttpProxy,
|
||||
@ -242,7 +250,7 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata,
|
||||
}
|
||||
|
||||
outputIndex := pb.OutputIndex(-1)
|
||||
if !m.readonly && m.cacheID == "" && !m.tmpfs {
|
||||
if !m.noOutput && !m.readonly && m.cacheID == "" && !m.tmpfs {
|
||||
outputIndex = pb.OutputIndex(outIndex)
|
||||
outIndex++
|
||||
}
|
||||
@ -338,7 +346,7 @@ func (e *ExecOp) getMountIndexFn(m *mount) func() (pb.OutputIndex, error) {
|
||||
|
||||
i := 0
|
||||
for _, m2 := range e.mounts {
|
||||
if m2.readonly || m2.cacheID != "" {
|
||||
if m2.noOutput || m2.readonly || m2.cacheID != "" {
|
||||
continue
|
||||
}
|
||||
if m == m2 {
|
||||
@ -379,6 +387,10 @@ func SourcePath(src string) MountOption {
|
||||
}
|
||||
}
|
||||
|
||||
func ForceNoOutput(m *mount) {
|
||||
m.noOutput = true
|
||||
}
|
||||
|
||||
func AsPersistentCacheDir(id string, sharing CacheMountSharingMode) MountOption {
|
||||
return func(m *mount) {
|
||||
m.cacheID = id
|
||||
@ -408,6 +420,12 @@ func Network(n pb.NetMode) RunOption {
|
||||
})
|
||||
}
|
||||
|
||||
func Security(s pb.SecurityMode) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = security(s)(ei.State)
|
||||
})
|
||||
}
|
||||
|
||||
func Shlex(str string) RunOption {
|
||||
return Shlexf(str)
|
||||
}
|
||||
@ -623,3 +641,8 @@ const (
|
||||
NetModeHost = pb.NetMode_HOST
|
||||
NetModeNone = pb.NetMode_NONE
|
||||
)
|
||||
|
||||
const (
|
||||
SecurityModeInsecure = pb.SecurityMode_INSECURE
|
||||
SecurityModeSandbox = pb.SecurityMode_SANDBOX
|
||||
)
|
||||
|
16
vendor/github.com/moby/buildkit/client/llb/meta.go
generated
vendored
16
vendor/github.com/moby/buildkit/client/llb/meta.go
generated
vendored
@ -21,6 +21,7 @@ var (
|
||||
keyExtraHost = contextKeyT("llb.exec.extrahost")
|
||||
keyPlatform = contextKeyT("llb.platform")
|
||||
keyNetwork = contextKeyT("llb.network")
|
||||
keySecurity = contextKeyT("llb.security")
|
||||
)
|
||||
|
||||
func addEnvf(key, value string, v ...interface{}) StateOption {
|
||||
@ -148,7 +149,6 @@ func network(v pb.NetMode) StateOption {
|
||||
return s.WithValue(keyNetwork, v)
|
||||
}
|
||||
}
|
||||
|
||||
func getNetwork(s State) pb.NetMode {
|
||||
v := s.Value(keyNetwork)
|
||||
if v != nil {
|
||||
@ -158,6 +158,20 @@ func getNetwork(s State) pb.NetMode {
|
||||
return NetModeSandbox
|
||||
}
|
||||
|
||||
func security(v pb.SecurityMode) StateOption {
|
||||
return func(s State) State {
|
||||
return s.WithValue(keySecurity, v)
|
||||
}
|
||||
}
|
||||
func getSecurity(s State) pb.SecurityMode {
|
||||
v := s.Value(keySecurity)
|
||||
if v != nil {
|
||||
n := v.(pb.SecurityMode)
|
||||
return n
|
||||
}
|
||||
return SecurityModeSandbox
|
||||
}
|
||||
|
||||
type EnvList []KeyValue
|
||||
|
||||
type KeyValue struct {
|
||||
|
8
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
8
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
@ -214,6 +214,7 @@ func (s State) Run(ro ...RunOption) ExecState {
|
||||
ProxyEnv: ei.ProxyEnv,
|
||||
ExtraHosts: getExtraHosts(ei.State),
|
||||
Network: getNetwork(ei.State),
|
||||
Security: getSecurity(ei.State),
|
||||
}
|
||||
|
||||
exec := NewExecOp(s.Output(), meta, ei.ReadonlyRootFS, ei.Constraints)
|
||||
@ -292,6 +293,13 @@ func (s State) Network(n pb.NetMode) State {
|
||||
func (s State) GetNetwork() pb.NetMode {
|
||||
return getNetwork(s)
|
||||
}
|
||||
func (s State) Security(n pb.SecurityMode) State {
|
||||
return security(n)(s)
|
||||
}
|
||||
|
||||
func (s State) GetSecurity() pb.SecurityMode {
|
||||
return getSecurity(s)
|
||||
}
|
||||
|
||||
func (s State) With(so ...StateOption) State {
|
||||
for _, o := range so {
|
||||
|
Reference in New Issue
Block a user