exec: mount: fs: support readonly mounts
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
e5de27f098
commit
e7d8f17884
@ -138,6 +138,11 @@ func (v *Value) Int64() (int64, error) {
|
|||||||
return v.val.Int64()
|
return v.val.Int64()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Proxy function to the underlying cue.Value
|
||||||
|
func (v *Value) Bool() (bool, error) {
|
||||||
|
return v.val.Bool()
|
||||||
|
}
|
||||||
|
|
||||||
// Proxy function to the underlying cue.Value
|
// Proxy function to the underlying cue.Value
|
||||||
func (v *Value) Path() cue.Path {
|
func (v *Value) Path() cue.Path {
|
||||||
return v.val.Path()
|
return v.val.Path()
|
||||||
|
@ -191,7 +191,7 @@ func (t *execTask) mountCache(_ *plancontext.Context, dest string, mnt *compiler
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
concurrency, err := mnt.Lookup("concurrency").String()
|
concurrency, err := contents.Lookup("concurrency").String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -236,13 +236,15 @@ func (t *execTask) mountFS(pctx *plancontext.Context, dest string, mnt *compiler
|
|||||||
mo = append(mo, llb.SourcePath(src))
|
mo = append(mo, llb.SourcePath(src))
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: handle readonly
|
if ro := mnt.Lookup("ro"); ro.Exists() {
|
||||||
// if readonly := mnt.Lookup("ro"); readonly.Exists() {
|
readonly, err := ro.Bool()
|
||||||
// ro, err := readonly.Cue().Bool()
|
if err != nil {
|
||||||
// if err != nil {
|
return nil, err
|
||||||
// return nil, err
|
}
|
||||||
// }
|
if readonly {
|
||||||
// }
|
mo = append(mo, llb.Readonly)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
st, err := contents.Result().ToState()
|
st, err := contents.Result().ToState()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -30,6 +30,40 @@ engine.#Plan & {
|
|||||||
"sh", "-c",
|
"sh", "-c",
|
||||||
#"""
|
#"""
|
||||||
test "$(cat /target/output.txt)" = "hello world"
|
test "$(cat /target/output.txt)" = "hello world"
|
||||||
|
touch /target/rw
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
verifyRO: engine.#Exec & {
|
||||||
|
input: image.output
|
||||||
|
mounts: fs: {
|
||||||
|
dest: "/target"
|
||||||
|
contents: exec.output
|
||||||
|
ro: true
|
||||||
|
}
|
||||||
|
args: [
|
||||||
|
"sh", "-c",
|
||||||
|
#"""
|
||||||
|
test "$(cat /target/output.txt)" = "hello world"
|
||||||
|
|
||||||
|
touch /target/ro && exit 1
|
||||||
|
true
|
||||||
|
"""#,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
verifySource: engine.#Exec & {
|
||||||
|
input: image.output
|
||||||
|
mounts: fs: {
|
||||||
|
dest: "/target.txt"
|
||||||
|
contents: exec.output
|
||||||
|
source: "/output.txt"
|
||||||
|
}
|
||||||
|
args: [
|
||||||
|
"sh", "-c",
|
||||||
|
#"""
|
||||||
|
test "$(cat /target.txt)" = "hello world"
|
||||||
"""#,
|
"""#,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user