Rename mode
to permissions
in fs.cue
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
parent
8819a859a1
commit
fd6d1b55fe
@ -24,8 +24,8 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mode (int)
|
// Permissions (int)
|
||||||
mode, err := v.Lookup("mode").Int64()
|
permissions, err := v.Lookup("permissions").Int64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
|
|||||||
|
|
||||||
// Add Mkdir operation on input llb state
|
// Add Mkdir operation on input llb state
|
||||||
outputState := inputState.File(
|
outputState := inputState.File(
|
||||||
llb.Mkdir(path, fs.FileMode(mode), mkdirOpts...),
|
llb.Mkdir(path, fs.FileMode(permissions), mkdirOpts...),
|
||||||
withCustomName(v, "Mkdir %s", path),
|
withCustomName(v, "Mkdir %s", path),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
mode, err := v.Lookup("mode").Int64()
|
permissions, err := v.Lookup("permissions").Int64()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -67,7 +67,7 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
|
|||||||
}
|
}
|
||||||
|
|
||||||
outputState := inputState.File(
|
outputState := inputState.File(
|
||||||
llb.Mkfile(path, fs.FileMode(mode), contents),
|
llb.Mkfile(path, fs.FileMode(permissions), contents),
|
||||||
withCustomName(v, "WriteFile %s", path),
|
withCustomName(v, "WriteFile %s", path),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fs := pctx.FS.New(result)
|
outputFS := pctx.FS.New(result)
|
||||||
|
|
||||||
output := compiler.NewValue()
|
output := compiler.NewValue()
|
||||||
|
|
||||||
if err := output.FillPath(cue.ParsePath("output"), fs.MarshalCUE()); err != nil {
|
if err := output.FillPath(cue.ParsePath("output"), outputFS.MarshalCUE()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ package engine
|
|||||||
// It can be nested (e.g : "/foo" or "/foo/bar")
|
// It can be nested (e.g : "/foo" or "/foo/bar")
|
||||||
path: string
|
path: string
|
||||||
|
|
||||||
// Permissions to set
|
// Permissions of the directory
|
||||||
mode: *0o755 | int
|
permissions: *0o755 | int
|
||||||
|
|
||||||
// If set, it creates parents' directory if they do not exist
|
// If set, it creates parents' directory if they do not exist
|
||||||
parents: *true | false
|
parents: *true | false
|
||||||
@ -43,8 +43,7 @@ package engine
|
|||||||
// Contents to write
|
// Contents to write
|
||||||
contents: string
|
contents: string
|
||||||
// Permissions of the file
|
// Permissions of the file
|
||||||
// FIXME: rename to 'permissions' for consistency
|
permissions: int
|
||||||
mode: int
|
|
||||||
// Output filesystem tree
|
// Output filesystem tree
|
||||||
output: #FS
|
output: #FS
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ engine.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeChecker: engine.#WriteFile & {
|
writeChecker: engine.#WriteFile & {
|
||||||
input: mkdir.output
|
input: mkdir.output
|
||||||
path: "/test/foo"
|
path: "/test/foo"
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
mode: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
|
|
||||||
readChecker: engine.#ReadFile & {
|
readChecker: engine.#ReadFile & {
|
||||||
|
@ -17,10 +17,10 @@ engine.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeChecker: engine.#WriteFile & {
|
writeChecker: engine.#WriteFile & {
|
||||||
input: mkdir.output
|
input: mkdir.output
|
||||||
path: "/test/baz/foo"
|
path: "/test/baz/foo"
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
mode: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
|
|
||||||
readChecker: engine.#ReadFile & {
|
readChecker: engine.#ReadFile & {
|
||||||
|
@ -16,10 +16,10 @@ engine.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeChecker: engine.#WriteFile & {
|
writeChecker: engine.#WriteFile & {
|
||||||
input: mkdir.output
|
input: mkdir.output
|
||||||
path: "/test/baz/foo"
|
path: "/test/baz/foo"
|
||||||
contents: "bar"
|
contents: "bar"
|
||||||
mode: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
|
|
||||||
readChecker: engine.#ReadFile & {
|
readChecker: engine.#ReadFile & {
|
||||||
|
@ -10,10 +10,10 @@ engine.#Plan & {
|
|||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
write: engine.#WriteFile & {
|
write: engine.#WriteFile & {
|
||||||
input: pull.output
|
input: pull.output
|
||||||
path: "/testing"
|
path: "/testing"
|
||||||
contents: "1,2,3"
|
contents: "1,2,3"
|
||||||
mode: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
readfile: engine.#ReadFile & {
|
readfile: engine.#ReadFile & {
|
||||||
input: write.output
|
input: write.output
|
||||||
|
@ -10,10 +10,10 @@ engine.#Plan & {
|
|||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
||||||
}
|
}
|
||||||
write: engine.#WriteFile & {
|
write: engine.#WriteFile & {
|
||||||
input: pull.output
|
input: pull.output
|
||||||
path: "/testing"
|
path: "/testing"
|
||||||
contents: "1,2,3,4"
|
contents: "1,2,3,4"
|
||||||
mode: 700
|
permissions: 700
|
||||||
}
|
}
|
||||||
readfile: engine.#ReadFile & {
|
readfile: engine.#ReadFile & {
|
||||||
input: write.output
|
input: write.output
|
||||||
|
Reference in New Issue
Block a user