NVIDIA / container-canary

A tool for testing and validating container requirements against versioned manifests
Apache License 2.0
237 stars 15 forks source link

--debug flag causes panic #43

Open jacobtomlinson opened 1 year ago

jacobtomlinson commented 1 year ago
$ canary version                                              
Container Canary
 Version:         v0.2.1
 Go Version:      go1.17.8
 Commit:          d97ec23
 OS/Arch:         linux/amd64
 Built:           2022-04-14T10:03:44Z

$ canary validate --file examples/awesome.yaml ubuntu --debug     
Validating ubuntu against awesome
Running container with command 'docker run -d --name canary-runner-f716bacd ubuntu sleep 30'
 πŸ“¦ Required packages are installed                  [passed]
 πŸ€– Expected services are running                    [passed]
 πŸŽ‰ Your container is awesome                        [passed]
validation passed
Caught panic:

runtime error: invalid memory address or nil pointer dereference

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
        /opt/hostedtoolcache/go/1.17.8/x64/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
        /opt/hostedtoolcache/go/1.17.8/x64/src/runtime/debug/stack.go:16 +0x19
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func3()
        /home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.20.0/tea.go:359 +0x95
panic({0xb3e660, 0x11f1150})
        /opt/hostedtoolcache/go/1.17.8/x64/src/runtime/panic.go:1047 +0x266
github.com/nvidia/container-canary/internal/validator.model.View({0xc000048360, {0xd116d8, 0xc00035a000}, 0x1, {0xc0001dc8c0, 0x3, 0x4}, 0x1, {{{0x11f6e60, 0x4, ...}, ...}, ...}, ...})
        /home/runner/work/container-canary/container-canary/internal/validator/validator.go:184 +0x185
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel(0xc0001b0200)
        /home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.20.0/tea.go:549 +0x1438
github.com/nvidia/container-canary/internal/validator.Validate({0x7fff7bb98156, 0x6}, {0x7fff7bb98140, 0x15}, 0xc0000dbdd0, 0x1)
        /home/runner/work/container-canary/container-canary/internal/validator/validator.go:239 +0x545
github.com/nvidia/container-canary/cmd.glob..func1(0x11f91c0, {0xc00009ac40, 0x1, 0x4})
        /home/runner/work/container-canary/container-canary/cmd/validate.go:50 +0xd1
github.com/spf13/cobra.(*Command).execute(0x11f91c0, {0xc00009ac00, 0x4, 0x4})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0x11f8f40)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/nvidia/container-canary/cmd.Execute()
        /home/runner/work/container-canary/container-canary/cmd/root.go:44 +0x25
main.main()
        /home/runner/work/container-canary/container-canary/main.go:23 +0x17
Error: program returned unknown model
danielballan commented 1 year ago

Drive-by comment to say:

Thanks for sharing this useful work!