turbot / flowpipe

Flowpipe is a cloud scripting engine. Automation and workflow to connect your clouds to the people, systems and data that matters.
https://flowpipe.io
GNU Affero General Public License v3.0
361 stars 13 forks source link

Array Index out of bounds when running `flowpipe pipelines run` without a specified pipeline to run #108

Closed Joeturbot closed 11 months ago

Joeturbot commented 11 months ago

Shouldn't stacktrace when no pipeline has been specified. Ideally, would provide a list of pipelines that could be run. Flowpipe doesn't hard crash but gives the impression that it might have. (Stacktraces usually mean hard crashes.

Context: I'm trying to feel my way to executing a specific pipeline by doing successively more directed commands.

turbot@slim-pikkens:~/flowpipe/flowpipe-mod-pipes$ flowpipe pipeline list
2023-10-11T12:35:10.015+0800    INFO    received list pipelines request {"next_token": "", "limit": 25}
2023-10-11T12:35:10.016+0800    INFO    /api/v0/pipeline        {"status": 200, "method": "GET", "path": "/api/v0/pipeline", "query": "limit=25&next_token=", "ip": "::1", "user-agent": "OpenAPI-Generator/1.0.0/go", "latency": "1.666706ms", "time": "2023-10-11T04:35:10Z"}
MOD                   NAME                                            DESCRIPTION
pipes_integrations    pipes_integrations.pipeline.pipes_list_users    
turbot@slim-pikkens:~/flowpipe/flowpipe-mod-pipes$ flowpipe pipeline run
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/turbot/flowpipe/internal/cmd/pipeline.PipelineRunCmd.runPipelineFunc.func1(0xc0001aea00?, {0x2a98420, 0x0, 0x18b6a20?})
        /home/runner/work/flowpipe/flowpipe/flowpipe/internal/cmd/pipeline/pipeline.go:119 +0x62e
github.com/spf13/cobra.(*Command).execute(0xc00054d200, {0x2a98420, 0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x863
github.com/spf13/cobra.(*Command).ExecuteC(0xc00054c300)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/turbot/flowpipe/internal/cmd.RunCLI({0x1d8efc0?, 0xc000650de0?})
        /home/runner/work/flowpipe/flowpipe/flowpipe/internal/cmd/cmd.go:14 +0x2a
main.main()
        /home/runner/work/flowpipe/flowpipe/flowpipe/main.go:38 +0x218
bigdatasourav commented 11 months ago

Addressed in this commit