arcalot / arcaflow-engine

Arcaflow is a highly-portable workflow engine enabling modular and validated pipelines through containerized plugins.
https://arcalot.io/arcaflow/
Apache License 2.0
7 stars 9 forks source link

Engine crashes when a bare string value is passed as a default in a workflow #87

Open dustinblack opened 1 year ago

dustinblack commented 1 year ago

Describe the bug

When setting a default string value for a workflow input parameter, if a bare string is used, the engine will panic.

To reproduce

The supported syntax for a default string value is:

    default: '"foo"'

If instead this is used:

    default: foo

The engine will panic

panic: Default value for property kubeburner_churn is not a valid JSON (invalid character 'h' looking for beginning of value)                                                                    

goroutine 1 [running]:                                                                                                                                                                                                                        
go.flow.arcalot.io/pluginsdk/schema.extractObjectDefaultValues(0x15d9dc0?)
        /home/runner/go/pkg/mod/go.flow.arcalot.io/pluginsdk@v0.1.0/schema/object.go:601 +0x205                                                                                                                                               
go.flow.arcalot.io/pluginsdk/schema.(*ObjectSchema).GetDefaults(...)                           
        /home/runner/go/pkg/mod/go.flow.arcalot.io/pluginsdk@v0.1.0/schema/object.go:54                      
go.flow.arcalot.io/pluginsdk/schema.(*ObjectSchema).convertData(0xc0003efd60, {0x15d68e0?, 0xc0003f3c50?, 0x17f0aa8?})
        /home/runner/go/pkg/mod/go.flow.arcalot.io/pluginsdk@v0.1.0/schema/object.go:375 +0x14d
go.flow.arcalot.io/pluginsdk/schema.(*ObjectSchema).Unserialize(0xc0003efd60, {0x15d68e0?, 0xc0003f3c50?})
        /home/runner/go/pkg/mod/go.flow.arcalot.io/pluginsdk@v0.1.0/schema/object.go:84 +0x14a     
go.flow.arcalot.io/pluginsdk/schema.(*ScopeSchema).Unserialize(...)                                 
        /home/runner/go/pkg/mod/go.flow.arcalot.io/pluginsdk@v0.1.0/schema/scope.go:67
go.flow.arcalot.io/engine.workflowEngine.RunWorkflow({{0x1a8d458, 0xc0002e7bf0}, {0x1a81100, 0xc0002fe358}, 0xc0005249a0}, {0x1a8c458?, 0xc0004ba4c0}, {0xc00060e000, 0xcf5c, 0xcf5d}, ...)
        /home/runner/go/pkg/mod/go.flow.arcalot.io/engine@v0.3.3/engine.go:69 +0x187                                 
main.main()                                                                                                                                                                                                                                   
        /home/runner/go/pkg/mod/go.flow.arcalot.io/engine@v0.3.3/cmd/arcaflow/main.go:124 +0xa37

Additional context

It would be best if the fix for this included an enhancement to allow standard valid yaml values to be passed to the default key -- i.e., a bare string should be valid and should work.

jdowni000 commented 1 year ago

I have tested locally and pushed to a new branch here. I still need to create some unit tests though for the code, but a lot of progress has been made