konveyor / kantra

A CLI that unifies analysis and transformation capabilities of Konveyor
Apache License 2.0
9 stars 27 forks source link

:bug: Handle missing containerless-deps #349

Closed aufi closed 1 month ago

aufi commented 1 month ago

Missing container-kantra-deps setup caused kantra analyze-bin command failure (details below). Appears when someone skips README step cloning and moving https://github.com/eemcmullan/containerless-kantra-deps.git to ~/.kantra

Adding check and error message to fail nicely.

Related to: https://github.com/konveyor/kantra/pull/338

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb8c330]

goroutine 1 [running]:
github.com/konveyor-ecosystem/kantra/cmd.(*analyzeBinCommand).walkRuleFilesForLabels.walkRuleSets.func1({0xc0000434c0, 0x1e}, {0x0?, 0x0?}, {0xf049e0, 0xc00026f0b0})
    /home/.../go/src/github.com/konveyor/kantra/cmd/util.go:37 +0x30
path/filepath.WalkDir({0xc0000434c0, 0x1e}, 0xc00020fa08)
    /usr/lib/golang/src/path/filepath/path.go:531 +0x9c
github.com/konveyor-ecosystem/kantra/cmd.(*analyzeBinCommand).walkRuleFilesForLabels(0x7f7c626c24e8?, {0xdb3b53, 0x12})
    /home/.../go/src/github.com/konveyor/kantra/cmd/analyze-bin.go:433 +0xc5
github.com/konveyor-ecosystem/kantra/cmd.(*analyzeBinCommand).fetchLabels(0xc000196b00, {0xe?, 0x1?}, 0x14?, 0x0?, {0xf04740, 0xc00026f080})
    /home/.../go/src/github.com/konveyor/kantra/cmd/analyze-bin.go:418 +0x4d
github.com/konveyor-ecosystem/kantra/cmd.(*analyzeBinCommand).Validate(0xc000196b00, {0xf0d608, 0xc0000bb3b0})
    /home/.../go/src/github.com/konveyor/kantra/cmd/analyze-bin.go:315 +0x22f
github.com/konveyor-ecosystem/kantra/cmd.NewAnalyzeBinCmd.func1(0xc000284f08, {0xc00029e060?, 0x4?, 0xda66ad?})
    /home/.../go/src/github.com/konveyor/kantra/cmd/analyze-bin.go:95 +0x192
github.com/spf13/cobra.(*Command).execute(0xc000284f08, {0xc00029e000, 0x6, 0x6})
    /home/.../go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:970 +0xa44
github.com/spf13/cobra.(*Command).ExecuteC(0x152ec00)
    /home/.../go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    /home/.../go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    /home/.../go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1034
github.com/konveyor-ecosystem/kantra/cmd.Execute()
    /home/.../go/src/github.com/konveyor/kantra/cmd/root.go:67 +0x10c
main.main()
    /home/.../go/src/github.com/konveyor/kantra/main.go:8 +0xf
eemcmullan commented 1 month ago

Thank you!