engine: LoadSecret->NewSecret
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
6a70271ff2
commit
5f840723e2
@ -138,18 +138,6 @@ _No input._
|
|||||||
|
|
||||||
_No output._
|
_No output._
|
||||||
|
|
||||||
## engine.#LoadSecret
|
|
||||||
|
|
||||||
Load a secret from a filesystem tree
|
|
||||||
|
|
||||||
### engine.#LoadSecret Inputs
|
|
||||||
|
|
||||||
_No input._
|
|
||||||
|
|
||||||
### engine.#LoadSecret Outputs
|
|
||||||
|
|
||||||
_No output._
|
|
||||||
|
|
||||||
## engine.#Merge
|
## engine.#Merge
|
||||||
|
|
||||||
Merge multiple FS trees into one
|
Merge multiple FS trees into one
|
||||||
@ -186,6 +174,18 @@ _No input._
|
|||||||
|
|
||||||
_No output._
|
_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
|
## engine.#Plan
|
||||||
|
|
||||||
A deployment plan executed by `dagger up`
|
A deployment plan executed by `dagger up`
|
||||||
|
@ -12,13 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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()
|
path, err := v.Lookup("path").String()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -49,6 +49,6 @@ func (t *loadSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s s
|
|||||||
secret := pctx.Secrets.New(plaintext)
|
secret := pctx.Secrets.New(plaintext)
|
||||||
|
|
||||||
return compiler.NewValue().FillFields(map[string]interface{}{
|
return compiler.NewValue().FillFields(map[string]interface{}{
|
||||||
"contents": secret.MarshalCUE(),
|
"output": secret.MarshalCUE(),
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package engine
|
package engine
|
||||||
|
|
||||||
// Load a secret from a filesystem tree
|
// Create a new a secret from a filesystem tree
|
||||||
#LoadSecret: {
|
#NewSecret: {
|
||||||
$dagger: task: _name: "LoadSecret"
|
$dagger: task: _name: "NewSecret"
|
||||||
|
|
||||||
// Filesystem tree holding the secret
|
// Filesystem tree holding the secret
|
||||||
input: #FS
|
input: #FS
|
||||||
@ -11,5 +11,5 @@ package engine
|
|||||||
// Whether to trim leading and trailing space characters from secret value
|
// Whether to trim leading and trailing space characters from secret value
|
||||||
trimSpace: *true | false
|
trimSpace: *true | false
|
||||||
// Contents of the secret
|
// Contents of the secret
|
||||||
contents: #Secret
|
output: #Secret
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,8 @@ setup() {
|
|||||||
assert_failure
|
assert_failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "task: #LoadSecret" {
|
@test "task: #NewSecret" {
|
||||||
cd "$TESTDIR"/tasks/loadsecret
|
cd "$TESTDIR"/tasks/newsecret
|
||||||
|
|
||||||
"$DAGGER" --europa up ./loadsecret.cue
|
"$DAGGER" --europa up ./newsecret.cue
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ engine.#Plan & {
|
|||||||
args: ["sh", "-c", "echo test > /secret"]
|
args: ["sh", "-c", "echo test > /secret"]
|
||||||
}
|
}
|
||||||
|
|
||||||
load: engine.#LoadSecret & {
|
load: engine.#NewSecret & {
|
||||||
input: generate.output
|
input: generate.output
|
||||||
path: "/secret"
|
path: "/secret"
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ engine.#Plan & {
|
|||||||
input: image.output
|
input: image.output
|
||||||
mounts: secret: {
|
mounts: secret: {
|
||||||
dest: "/run/secrets/test"
|
dest: "/run/secrets/test"
|
||||||
contents: load.contents
|
contents: load.output
|
||||||
}
|
}
|
||||||
args: [
|
args: [
|
||||||
"sh", "-c",
|
"sh", "-c",
|
Reference in New Issue
Block a user