Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions core/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,19 @@ func (n *Inputs) InputValueById(ec *ExecutionState, host NodeWithInputs, inputId
if !inputDefExists {
inputDef, inputDefExists = n.inputDefs[inputId]
}
if inputDefExists && inputDef.Type == "option" {
switch c := finalValue.(type) {
case string:
finalValue = strings.Trim(c, " \n\r")
case int8, int16, int32, int64, int, uint8, uint16, uint32, uint64, uint:
nv := reflect.ValueOf(c).Int()
if len(inputDef.Options) > 0 && int(nv) >= len(inputDef.Options) {
return nil, CreateErr(ec, nil, "option value out of range: %v", nv)
if inputDefExists {
switch inputDef.Type {
case "option":
switch c := finalValue.(type) {
case string:
finalValue = strings.Trim(c, " \n\r")
case int8, int16, int32, int64, int, uint8, uint16, uint32, uint64, uint:
nv := reflect.ValueOf(c).Int()
if len(inputDef.Options) > 0 && int(nv) >= len(inputDef.Options) {
return nil, CreateErr(ec, nil, "option value out of range: %v", nv)
}
finalValue = inputDef.Options[nv].Value
}
finalValue = inputDef.Options[nv].Value
}
}

Expand Down
33 changes: 30 additions & 3 deletions nodes/group@v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,36 @@ type GroupNode struct {
}

func (n *GroupNode) OutputValueById(c *core.ExecutionState, outputId core.OutputId) (any, error) {
v, err := n.InputValueById(c, n, core.InputId(outputId), nil)
if err != nil {
return nil, err

var (
err error
v any
)

// Nodes are responsible for resolving secrets, so is the group node if the secret input name
// is coming from the group node itself. Like the other nodes, secrets are empty if not found.
_, connected := n.GetDataSource(core.InputId(outputId))
if !connected {
inputDef, _, inputDefExists := n.Inputs.InputDefByPortId(string(outputId))
if inputDefExists && inputDef.Type == "secret" {
v, err = core.InputValueById[core.SecretValue](c, n, core.InputId(outputId))
if err != nil {
if strings.HasPrefix(err.Error(), "no secret found for") {
// empty secrets are ignored, similar to the core/secret-get node
// since the caller is responsible for checking the value
v = ""
} else {
return nil, err
}
}
}
}

if v == nil {
v, err = n.InputValueById(c, n, core.InputId(outputId), nil)
if err != nil {
return nil, err
}
}

return v, nil
Expand Down
6 changes: 3 additions & 3 deletions tests_e2e/references/reference_error_no_output.sh_l8
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ github.com/actionforge/actrun-cli/core.(*Outputs).OutputValueById
github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById
inputs.go:364
github.com/actionforge/actrun-cli/core.inputValueById[...]
inputs.go:475
inputs.go:478
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:470
inputs.go:473
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:552
inputs.go:555
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
Expand Down
22 changes: 11 additions & 11 deletions tests_e2e/references/reference_group-error.sh_l8
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:103
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl
Expand All @@ -162,23 +162,23 @@ github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:103
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl
group-outputs@v1.go:30
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl
Expand All @@ -194,31 +194,31 @@ github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
group-inputs@v1.go:39
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:103
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl
group-outputs@v1.go:30
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl
Expand All @@ -234,15 +234,15 @@ github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl
group-inputs@v1.go:39
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl
group@v1.go:75
group@v1.go:102
github.com/actionforge/actrun-cli/core.(*Executions).Execute
executions.go:56
github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl
Expand Down
2 changes: 1 addition & 1 deletion tests_e2e/references/reference_group-port-collision.sh_l13
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ error:

stack trace:
github.com/actionforge/actrun-cli/nodes.init.39.func1
group@v1.go:128
group@v1.go:155
github.com/actionforge/actrun-cli/core.NewNodeInstance
base.go:610
github.com/actionforge/actrun-cli/core.LoadNode
Expand Down
6 changes: 3 additions & 3 deletions tests_e2e/references/reference_index.sh_l20
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ github.com/actionforge/actrun-cli/nodes.(*ArrayGet).OutputValueById
github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById
inputs.go:364
github.com/actionforge/actrun-cli/core.inputValueById[...]
inputs.go:475
inputs.go:478
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:470
inputs.go:473
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:552
inputs.go:555
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
Expand Down
27 changes: 27 additions & 0 deletions tests_e2e/references/reference_secret.sh_l12
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,30 @@ PushNodeVisit: secret-v1-orange-blueberry-red, execute: false
PushNodeVisit: core-secret-get-v1-duck-starfruit-silver, execute: false
THIS_IS_A_SECRET_FROM_BASH
THIS_IS_A_SECRET_2_FROM_BASH
🟢 Execute 'Print (core-print-v1-plum-pink-green)'
PushNodeVisit: core-print-v1-plum-pink-green, execute: true
PushNodeVisit: core-secret-get-v1-navy-coconut-black, execute: false

🟢 Execute 'Set Secret (core-secret-set-v1-purple-strawberry-parrot)'
PushNodeVisit: core-secret-set-v1-purple-strawberry-parrot, execute: true
🟢 Execute 'Print (core-print-v1-dragonfruit-hippopotamus-blackberry)'
PushNodeVisit: core-print-v1-dragonfruit-hippopotamus-blackberry, execute: true
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
my-set-secret
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
🟢 Execute 'Group Inputs (core-group-inputs-v1-goose-boysenberry-pineapple)'
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: true
🟢 Execute 'Print (core-print-v1-snake-green-turquoise)'
PushNodeVisit: core-print-v1-snake-green-turquoise, execute: true
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
my-set-secret
{my-set-secret}
🟢 Execute 'Group Output (core-group-outputs-v1-parrot-purple-shark)'
PushNodeVisit: core-group-outputs-v1-parrot-purple-shark, execute: true
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
27 changes: 27 additions & 0 deletions tests_e2e/references/reference_secret.sh_l17
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,30 @@ PushNodeVisit: secret-v1-orange-blueberry-red, execute: false
PushNodeVisit: core-secret-get-v1-duck-starfruit-silver, execute: false
THIS_IS_ANOTHER_SECRET_FROM_BASH
THIS_IS_ANOTHER_SECRET_2_FROM_BASH
🟢 Execute 'Print (core-print-v1-plum-pink-green)'
PushNodeVisit: core-print-v1-plum-pink-green, execute: true
PushNodeVisit: core-secret-get-v1-navy-coconut-black, execute: false

🟢 Execute 'Set Secret (core-secret-set-v1-purple-strawberry-parrot)'
PushNodeVisit: core-secret-set-v1-purple-strawberry-parrot, execute: true
🟢 Execute 'Print (core-print-v1-dragonfruit-hippopotamus-blackberry)'
PushNodeVisit: core-print-v1-dragonfruit-hippopotamus-blackberry, execute: true
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
my-set-secret
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
🟢 Execute 'Group Inputs (core-group-inputs-v1-goose-boysenberry-pineapple)'
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: true
🟢 Execute 'Print (core-print-v1-snake-green-turquoise)'
PushNodeVisit: core-print-v1-snake-green-turquoise, execute: true
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
my-set-secret
{my-set-secret}
🟢 Execute 'Group Output (core-group-outputs-v1-parrot-purple-shark)'
PushNodeVisit: core-group-outputs-v1-parrot-purple-shark, execute: true
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
27 changes: 27 additions & 0 deletions tests_e2e/references/reference_secret.sh_l21
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,30 @@ PushNodeVisit: secret-v1-orange-blueberry-red, execute: false
PushNodeVisit: core-secret-get-v1-duck-starfruit-silver, execute: false
THIS_IS_API_KEY_123_FROM_SECRET_ACTCONFIG
ALIAS_FROM_SECRET_ACTCONFIG
🟢 Execute 'Print (core-print-v1-plum-pink-green)'
PushNodeVisit: core-print-v1-plum-pink-green, execute: true
PushNodeVisit: core-secret-get-v1-navy-coconut-black, execute: false

🟢 Execute 'Set Secret (core-secret-set-v1-purple-strawberry-parrot)'
PushNodeVisit: core-secret-set-v1-purple-strawberry-parrot, execute: true
🟢 Execute 'Print (core-print-v1-dragonfruit-hippopotamus-blackberry)'
PushNodeVisit: core-print-v1-dragonfruit-hippopotamus-blackberry, execute: true
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
my-set-secret
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
🟢 Execute 'Group Inputs (core-group-inputs-v1-goose-boysenberry-pineapple)'
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: true
🟢 Execute 'Print (core-print-v1-snake-green-turquoise)'
PushNodeVisit: core-print-v1-snake-green-turquoise, execute: true
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
PushNodeVisit: core-secret-get-v1-pineapple-navy-maroon, execute: false
PushNodeVisit: core-group-inputs-v1-goose-boysenberry-pineapple, execute: false
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: false
my-set-secret
{my-set-secret}
🟢 Execute 'Group Output (core-group-outputs-v1-parrot-purple-shark)'
PushNodeVisit: core-group-outputs-v1-parrot-purple-shark, execute: true
🟢 Execute 'Group (core-group-v1-sheep-papaya-date)'
PushNodeVisit: core-group-v1-sheep-papaya-date, execute: true
6 changes: 3 additions & 3 deletions tests_e2e/references/reference_select-data.sh_l9
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ github.com/actionforge/actrun-cli/nodes.(*SelectDataNode).OutputValueById
github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById
inputs.go:364
github.com/actionforge/actrun-cli/core.inputValueById[...]
inputs.go:475
inputs.go:478
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:470
inputs.go:473
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:552
inputs.go:555
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
Expand Down
6 changes: 3 additions & 3 deletions tests_e2e/references/reference_string-transform.sh_l61
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ github.com/actionforge/actrun-cli/nodes.(*StringTransform).OutputValueById
github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById
inputs.go:364
github.com/actionforge/actrun-cli/core.inputValueById[...]
inputs.go:475
inputs.go:478
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:470
inputs.go:473
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:552
inputs.go:555
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
Expand Down
Loading
Loading