From 5f840723e21524ec8413fed1af90f2e3d7d005b6 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Fri, 7 Jan 2022 11:52:16 -0800 Subject: [PATCH] engine: LoadSecret->NewSecret Signed-off-by: Andrea Luzzardi --- docs/reference/europa/dagger/engine.md | 24 +++++++++---------- plan/task/{loadsecret.go => newsecret.go} | 8 +++---- stdlib/europa/dagger/engine/secret.cue | 8 +++---- tests/tasks.bats | 6 ++--- .../newsecret.cue} | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) rename plan/task/{loadsecret.go => newsecret.go} (78%) rename tests/tasks/{loadsecret/loadsecret.cue => newsecret/newsecret.cue} (90%) diff --git a/docs/reference/europa/dagger/engine.md b/docs/reference/europa/dagger/engine.md index 34ee1528..b591dd29 100644 --- a/docs/reference/europa/dagger/engine.md +++ b/docs/reference/europa/dagger/engine.md @@ -138,18 +138,6 @@ _No input._ _No output._ -## engine.#LoadSecret - -Load a secret from a filesystem tree - -### engine.#LoadSecret Inputs - -_No input._ - -### engine.#LoadSecret Outputs - -_No output._ - ## engine.#Merge Merge multiple FS trees into one @@ -186,6 +174,18 @@ _No input._ _No output._ +## engine.#NewSecret + +Create a new a secret from a filesystem tree + +### engine.#NewSecret Inputs + +_No input._ + +### engine.#NewSecret Outputs + +_No output._ + ## engine.#Plan A deployment plan executed by `dagger up` diff --git a/plan/task/loadsecret.go b/plan/task/newsecret.go similarity index 78% rename from plan/task/loadsecret.go rename to plan/task/newsecret.go index 794e83b3..0fbaf8ec 100644 --- a/plan/task/loadsecret.go +++ b/plan/task/newsecret.go @@ -12,13 +12,13 @@ import ( ) func init() { - Register("LoadSecret", func() Task { return &loadSecretTask{} }) + Register("NewSecret", func() Task { return &newSecretTask{} }) } -type loadSecretTask struct { +type newSecretTask struct { } -func (t *loadSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { +func (t *newSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) { path, err := v.Lookup("path").String() if err != nil { return nil, err @@ -49,6 +49,6 @@ func (t *loadSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s s secret := pctx.Secrets.New(plaintext) return compiler.NewValue().FillFields(map[string]interface{}{ - "contents": secret.MarshalCUE(), + "output": secret.MarshalCUE(), }) } diff --git a/stdlib/europa/dagger/engine/secret.cue b/stdlib/europa/dagger/engine/secret.cue index a4cbe811..9a202622 100644 --- a/stdlib/europa/dagger/engine/secret.cue +++ b/stdlib/europa/dagger/engine/secret.cue @@ -1,8 +1,8 @@ package engine -// Load a secret from a filesystem tree -#LoadSecret: { - $dagger: task: _name: "LoadSecret" +// Create a new a secret from a filesystem tree +#NewSecret: { + $dagger: task: _name: "NewSecret" // Filesystem tree holding the secret input: #FS @@ -11,5 +11,5 @@ package engine // Whether to trim leading and trailing space characters from secret value trimSpace: *true | false // Contents of the secret - contents: #Secret + output: #Secret } diff --git a/tests/tasks.bats b/tests/tasks.bats index 765aa61d..193e7e57 100644 --- a/tests/tasks.bats +++ b/tests/tasks.bats @@ -126,8 +126,8 @@ setup() { assert_failure } -@test "task: #LoadSecret" { - cd "$TESTDIR"/tasks/loadsecret +@test "task: #NewSecret" { + cd "$TESTDIR"/tasks/newsecret - "$DAGGER" --europa up ./loadsecret.cue + "$DAGGER" --europa up ./newsecret.cue } diff --git a/tests/tasks/loadsecret/loadsecret.cue b/tests/tasks/newsecret/newsecret.cue similarity index 90% rename from tests/tasks/loadsecret/loadsecret.cue rename to tests/tasks/newsecret/newsecret.cue index 8ca558a5..5bebcbb2 100644 --- a/tests/tasks/loadsecret/loadsecret.cue +++ b/tests/tasks/newsecret/newsecret.cue @@ -15,7 +15,7 @@ engine.#Plan & { args: ["sh", "-c", "echo test > /secret"] } - load: engine.#LoadSecret & { + load: engine.#NewSecret & { input: generate.output path: "/secret" } @@ -24,7 +24,7 @@ engine.#Plan & { input: image.output mounts: secret: { dest: "/run/secrets/test" - contents: load.contents + contents: load.output } args: [ "sh", "-c",