Merge pull request #656 from AkihiroSuda/cap-ssh

define CapMountSSH
docker-18.09
Tõnis Tiigi 2018-10-02 23:21:17 -07:00 committed by GitHub
commit c9dc8352a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -199,6 +199,14 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata,
}
}
if len(e.secrets) > 0 {
addCap(&e.constraints, pb.CapExecMountSecret)
}
if len(e.ssh) > 0 {
addCap(&e.constraints, pb.CapExecMountSSH)
}
pop, md := MarshalConstraints(c, &e.constraints)
pop.Op = &pb.Op_Exec{
Exec: peo,
@ -266,10 +274,6 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata,
peo.Mounts = append(peo.Mounts, pm)
}
if len(e.secrets) > 0 {
addCap(&e.constraints, pb.CapMountSecret)
}
for _, s := range e.secrets {
pm := &pb.Mount{
Dest: s.Target,

View File

@ -207,7 +207,7 @@ func defaultLLBCaps() []apicaps.PBCap {
{ID: string(opspb.CapExecMountCacheSharing), Enabled: true},
{ID: string(opspb.CapExecMountSelector), Enabled: true},
{ID: string(opspb.CapExecMountTmpfs), Enabled: true},
{ID: string(opspb.CapMountSecret), Enabled: true},
{ID: string(opspb.CapExecMountSecret), Enabled: true},
{ID: string(opspb.CapConstraints), Enabled: true},
{ID: string(opspb.CapPlatform), Enabled: true},
{ID: string(opspb.CapMetaIgnoreCache), Enabled: true},

View File

@ -39,7 +39,8 @@ const (
CapExecMountCacheSharing apicaps.CapID = "exec.mount.cache.sharing"
CapExecMountSelector apicaps.CapID = "exec.mount.selector"
CapExecMountTmpfs apicaps.CapID = "exec.mount.tmpfs"
CapMountSecret apicaps.CapID = "exec.mount.secret"
CapExecMountSecret apicaps.CapID = "exec.mount.secret"
CapExecMountSSH apicaps.CapID = "exec.mount.ssh"
CapConstraints apicaps.CapID = "constraints"
CapPlatform apicaps.CapID = "platform"
@ -207,7 +208,13 @@ func init() {
})
Caps.Init(apicaps.Cap{
ID: CapMountSecret,
ID: CapExecMountSecret,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapExecMountSSH,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})