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
20 changes: 10 additions & 10 deletions .github/workflows/graphs/build-test-publish.act
Original file line number Diff line number Diff line change
Expand Up @@ -657,28 +657,28 @@ nodes:
inputs:
value: actrun-notarization-macos.zip
- id: secret-v1-red-pineapple-guava
type: core/secret@v1
type: core/secret-get@v1
position:
x: 3620
y: 2680
inputs:
name: APPLE_ID
- id: secret-v1-monkey-silver-boysenberry
type: core/secret@v1
type: core/secret-get@v1
position:
x: 3620
y: 2790
inputs:
name: APPLE_ID_PASSWORD
- id: secret-v1-kiwano-pineapple-bear
type: core/secret@v1
type: core/secret-get@v1
position:
x: 2220
y: 2190
inputs:
name: APPLE_TEAM_IDENTITY
- id: secret-v1-cherry-pear-cranberry
type: core/secret@v1
type: core/secret-get@v1
position:
x: 3620
y: 2570
Expand Down Expand Up @@ -1281,7 +1281,7 @@ nodes:
substitutes[0]: null
fmt: '%s.pkg'
- id: secret-v1-giraffe-snake-tiger
type: core/secret@v1
type: core/secret-get@v1
position:
x: 10050
y: 3000
Expand Down Expand Up @@ -1928,7 +1928,7 @@ nodes:
description: ''
label: MacOS CodeSign
- id: secret-v1-cranberry-watermelon-starfruit
type: core/secret@v1
type: core/secret-get@v1
position:
x: 11090
y: 2200
Expand Down Expand Up @@ -2139,21 +2139,21 @@ nodes:
description: ''
label: MacOS Notarization
- id: secret-v1-persimmon-jackfruit-gold
type: core/secret@v1
type: core/secret-get@v1
position:
x: 11570
y: 2680
inputs:
name: APPLE_ID
- id: secret-v1-date-cow-shark
type: core/secret@v1
type: core/secret-get@v1
position:
x: 11570
y: 2790
inputs:
name: APPLE_ID_PASSWORD
- id: secret-v1-watermelon-gray-pineapple
type: core/secret@v1
type: core/secret-get@v1
position:
x: 11570
y: 2570
Expand Down Expand Up @@ -5058,7 +5058,7 @@ nodes:
x: 13840
y: 1090
- id: secret-v1-raspberry-apple-giraffe
type: core/secret@v1
type: core/secret-get@v1
position:
x: 13670
y: 2340
Expand Down
12 changes: 12 additions & 0 deletions core/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ type NodeTypeDefinitionBasic struct {
Label string `yaml:"label,omitempty" json:"label,omitempty" bson:"label,omitempty"`
Compact bool `yaml:"compact,omitempty" json:"compact,omitempty" bson:"compact,omitempty"`
GhMeta GhMetadata `yaml:"gh_meta" json:"gh_meta" bson:"gh_meta"`
Aliases []string `yaml:"aliases,omitempty" json:"aliases,omitempty" bson:"aliases,omitempty"`

// Used by the gateway to indicate errors when being retreived
Error string `yaml:"error,omitempty" json:"error,omitempty" bson:"error,omitempty"`
Expand Down Expand Up @@ -561,6 +562,17 @@ func RegisterNodeFactory(nodeDefStr string, fn nodeFactoryFunc) error {
nodeDef.FactoryFn = fn
registries[id] = nodeDef

for _, alias := range nodeDef.Aliases {
if strings.Contains(alias, "_") {
return CreateErr(nil, nil, "alias '%v' must not contain underscores", alias)
}
aliasId := fmt.Sprintf("%v@v%v", alias, nodeDef.Version)
if _, exists := registries[aliasId]; exists {
return CreateErr(nil, nil, "alias '%v' already registered", aliasId)
}
registries[aliasId] = nodeDef
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (e *LeafError) Error() string {
func (e *LeafError) ErrorWithCauses() string {
var lines []string

// 1. Top level error (no prefix)
// top level error (no prefix)
// iterate backwards for high-level first
for i := len(e.ErrorStack) - 1; i >= 0; i-- {
prefix := ""
Expand Down
3 changes: 2 additions & 1 deletion core/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,12 @@ func (n *Inputs) InputValueById(ec *ExecutionState, host NodeWithInputs, inputId

ec.PushNodeVisit(dataSource.SrcNode, false)
v, err := dataSource.SrcNodeOutputs.OutputValueById(ec, OutputId(outputCacheId))
ec.PopNodeVisit()
if err != nil {
return nil, err
}

ec.PopNodeVisit()

// handle slice indexing
if dataSource.SrcIndexOutputInfo != nil {
slice := reflect.ValueOf(v)
Expand Down
2 changes: 1 addition & 1 deletion node_interfaces/interface_core_random-number_v1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_interfaces/interface_core_secret-get_v1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions node_interfaces/interface_core_secret-set_v1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions nodes/secret@v1.go → nodes/secret-get@v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
ni "github.com/actionforge/actrun-cli/node_interfaces"
)

//go:embed secret@v1.yml
//go:embed secret-get@v1.yml
var secretDefinition string

type SecretNode struct {
Expand All @@ -18,12 +18,12 @@ type SecretNode struct {
}

func (n *SecretNode) OutputValueById(c *core.ExecutionState, outputId core.OutputId) (any, error) {
secretName, err := core.InputValueById[string](c, n, ni.Core_secret_v1_Input_name)
secretName, err := core.InputValueById[string](c, n, ni.Core_secret_get_v1_Input_name)
if err != nil {
return nil, err
}

prefix, err := core.InputValueById[string](c, n, ni.Core_secret_v1_Input_prefix)
prefix, err := core.InputValueById[string](c, n, ni.Core_secret_get_v1_Input_prefix)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions nodes/secret@v1.yml → nodes/secret-get@v1.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
yaml-version: 3.0

id: core/secret
id: core/secret-get
version: 1
name: Secret
aliases:
- core/secret
name: Get Secret
icon: octKey
category: system
short_desc: A node to read key secrets.
Expand Down
43 changes: 43 additions & 0 deletions nodes/secret-set@v1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package nodes

import (
_ "embed"

"github.com/actionforge/actrun-cli/core"
ni "github.com/actionforge/actrun-cli/node_interfaces"
)

//go:embed secret-set@v1.yml
var setSecretDefinition string

type SetSecretNode struct {
core.NodeBaseComponent
core.Executions
core.Inputs
core.Outputs
}

func (n *SetSecretNode) ExecuteImpl(c *core.ExecutionState, inputId core.InputId, prevError error) error {
secretName, err := core.InputValueById[string](c, n, ni.Core_secret_set_v1_Input_name)
if err != nil {
return err
}

secretValue, err := core.InputValueById[string](c, n, ni.Core_secret_set_v1_Input_value)
if err != nil {
return err
}

c.Secrets[secretName] = secretValue

return n.Execute(ni.Core_secret_set_v1_Output_exec_success, c, nil)
}

func init() {
err := core.RegisterNodeFactory(setSecretDefinition, func(ctx any, parent core.NodeBaseInterface, parentId string, nodeDef map[string]any, validate bool) (core.NodeBaseInterface, []error) {
return &SetSecretNode{}, nil
})
if err != nil {
panic(err)
}
}
41 changes: 41 additions & 0 deletions nodes/secret-set@v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
yaml-version: 3.0

id: core/secret-set
version: 1
name: Set Secret
icon: octKey
category: system
short_desc: A node to set a secret value at runtime.
long_desc: Sets a secret value that can be retrieved later using the Get Secret node.
style:
header:
background: "#3794ff"
body:
background: "#1f4f86"
inputs:
exec:
exec: true
index: 0
name: ''
desc: Triggers the setting of the secret.
name:
name: Name
type: string
hint: "e.g. MY_KEY"
required: true
desc: The name of the secret to set.
index: 1
value:
name: Value
type: string
hint: "e.g. secret-value"
required: true
desc: The value of the secret.
index: 2

outputs:
exec-success:
name: ''
exec: true
index: 0
desc: Triggered when the secret is successfully set.
9 changes: 5 additions & 4 deletions tests_e2e/references/reference_error_no_output.sh_l8
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@ actrun: error_no_output.act
error:
1: execute 'Start' (start)
2: execute 'Print' (print-v1-panda-orange-peacock)
3: request input from 'Run Executable' (run-exec-v1-wolf-guava-gray)
error when requesting input from 'Print' (print-v1-panda-orange-peacock) values at **first** input port
↳ output port 'output' has no value



hint:
No output value provided. Check the settings of 'Print' (print-v1-panda-orange-peacock) node
No output value provided. Check the settings of 'Run Executable' (run-exec-v1-wolf-guava-gray) node

stack trace:
github.com/actionforge/actrun-cli/core.(*Outputs).OutputValueById
outputs.go:112
github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById
inputs.go:364
github.com/actionforge/actrun-cli/core.inputValueById[...]
inputs.go:471
inputs.go:472
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:466
inputs.go:467
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:548
inputs.go:549
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
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 @@ -23,7 +23,7 @@ stack trace:
github.com/actionforge/actrun-cli/nodes.init.39.func1
group@v1.go:128
github.com/actionforge/actrun-cli/core.NewNodeInstance
base.go:598
base.go:610
github.com/actionforge/actrun-cli/core.LoadNode
graph.go:599
github.com/actionforge/actrun-cli/core.LoadNodes
Expand Down
7 changes: 4 additions & 3 deletions tests_e2e/references/reference_index.sh_l20
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ error:
4: execute 'Print' (print-v1-indigo-guava-elephant)
5: execute 'Print' (print-v1-indigo-guava-elephant)
6: execute 'Print' (print-v1-indigo-guava-elephant)
7: request input from 'Array Get' (array-get-v1-goose-chicken-nectarine)
error when requesting input from 'Print' (print-v1-indigo-guava-elephant) values at **first** input port
↳ index out of bounds: 3

Expand All @@ -65,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:471
inputs.go:472
github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...]
inputs.go:466
inputs.go:467
github.com/actionforge/actrun-cli/core.InputArrayValueById[...]
inputs.go:548
inputs.go:549
github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl
print@v1.go:27
github.com/actionforge/actrun-cli/core.(*Executions).Execute
Expand Down
2 changes: 1 addition & 1 deletion tests_e2e/references/reference_run-python-embedded.sh_l13
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stack trace:
github.com/actionforge/actrun-cli/nodes.init.50.func1
nrun-python-embedded@v1.go:16
github.com/actionforge/actrun-cli/core.NewNodeInstance
base.go:598
base.go:610
github.com/actionforge/actrun-cli/core.LoadNode
graph.go:599
github.com/actionforge/actrun-cli/core.LoadNodes
Expand Down
Loading
Loading