-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Pipelines 1.21.0
Description of problem:
When running tkn pac cel with -p gitlab against an invalid or malformed GitLab payload and headers, the command panics with a nil pointer dereference instead of failing gracefully with a clear error message.
Prerequisites (if any, like setup, operators/versions):
tkn-pac 0.39.2
Steps to Reproduce
Execute this command with an invalid payload and headers.txt
tkn pac cel -p gitlab -b gitlab.json -H headers.txt
Actual results:
The command panics with a Go runtime error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1e546ec]
goroutine 1 [running]:
github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel.(*GitLabParser).PopulateEvent(0xc000150800?, 0xc00053f908, {0x20c04a0?, 0xc00013bc08})
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel/parser.go:245 +0x10c
github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel.parseWebhookForCEL({0xc000150800, 0xe7, 0x200}, 0xc0002c2270, {0x2b6a660, 0x4207240})
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel/parser.go:117 +0xdb
github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel.eventFromGitLab(...)
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel/gitlab.go:9
github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel.Command.func1(0xc00013f600?, {0x27cc75d?, 0x4?, 0x27cc735?})
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/cel/cel.go:620 +0x645
github.com/spf13/cobra.(*Command).execute(0xc0002bcf08, {0xc00011d0e0, 0x6, 0x6})
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/vendor/github.com/spf13/cobra/command.go:1015 +0xb02
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001bb808)
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/vendor/github.com/spf13/cobra/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(0xc0003e4780?)
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/vendor/github.com/spf13/cobra/command.go:1071 +0x13
main.main()
/workspace/src/github.com/openshift-pipelines/pipelines-as-code/cmd/tkn-pac/main.go:14 +0xaa
Expected results:
tkn pac cel should not panic on invalid or malformed input.
Should print clear error message
Reproducibility (Always/Intermittent/Only Once):
Always