enonic / cli-enonic

GNU General Public License v3.0
41 stars 1 forks source link

Error parsing selected distro version #511

Closed edloidas closed 7 months ago

edloidas commented 7 months ago

If user runs enonic sandbox create and selects non-default XP version, version number won't be parsed and distro value will be set in .enonic/sandboxes/<SANDBOX>/.enonic config TOML file like this: enonic-xp-mac-arm64-sdk-. This will lead to errors, when using trying to use that sandbox and parse it's version:

panic: Invalid Semantic Version

goroutine 1 [running]:
github.com/Masterminds/semver.MustParse(...)
        /opt/homebrew/opt/go/pkg/mod/github.com/!masterminds/semver@v1.5.0/version.go:100
cli-enonic/internal/app/commands/sandbox.EnsureSanboxSupportsProjectVersion(0x1400007da60, 0x1400007f860)
        /Users/edloidas/repo/cli-enonic/internal/app/commands/sandbox/distro.go:357 +0x1e4
cli-enonic/internal/app/commands/project.ensureProjectDataExists(0x140001a6580, {0x100b1cfde, 0x1b}, {0x0, 0x0}, {0x100b337be, 0x46})
        /Users/edloidas/repo/cli-enonic/internal/app/commands/project/project.go:95 +0x334
cli-enonic/internal/app/commands/project.glob..func4(0x140001a6580)
        /Users/edloidas/repo/cli-enonic/internal/app/commands/project/deploy.go:39 +0xc4
github.com/urfave/cli.HandleAction({0x100c3f2e0?, 0x100d06858?}, 0x6?)
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:524 +0x58
github.com/urfave/cli.Command.Run({{0x100b07702, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x100b240ef, 0x23}, {0x0, ...}, ...}, ...)
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:175 +0x4f0
github.com/urfave/cli.(*App).RunAsSubcommand(0x140001c2380, 0x140001a62c0)
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:405 +0xa3c
github.com/urfave/cli.Command.startApp({{0x100b09229, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x100b187c4, 0x16}, {0x0, ...}, ...}, ...)
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:380 +0x934
github.com/urfave/cli.Command.Run({{0x100b09229, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x100b187c4, 0x16}, {0x0, ...}, ...}, ...)
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/command.go:103 +0x63c
github.com/urfave/cli.(*App).Run(0x140001c21c0, {0x14000020080, 0x4, 0x4})
        /opt/homebrew/opt/go/pkg/mod/github.com/urfave/cli@v1.22.14/app.go:277 +0x7c8
main.main()
        /Users/edloidas/repo/cli-enonic/internal/app/cli.go:35 +0x444
exit status 2

The origin of this issue is that we no longer always add stability description when parsing versions https://github.com/enonic/cli-enonic/commit/836685b3b433c8be634597cb2e776c847022f2e6.