From 43d3f21ff06544b1d41b8d694c32f7cf538256b9 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 28 Oct 2022 11:26:22 +0200 Subject: [PATCH] Only provide version ot build-frontend-packages if it's a valid semver (has 2 digits) (#57808) (#57810) (cherry picked from commit fd16cad7da36420148ae5811cfefa9876ce8f782) Co-authored-by: Kevin Minehart --- pkg/build/cmd/buildfrontendpackages.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/build/cmd/buildfrontendpackages.go b/pkg/build/cmd/buildfrontendpackages.go index eb329428e0a..786ebccaff7 100644 --- a/pkg/build/cmd/buildfrontendpackages.go +++ b/pkg/build/cmd/buildfrontendpackages.go @@ -13,7 +13,11 @@ import ( func BuildFrontendPackages(c *cli.Context) error { version := "" if c.NArg() == 1 { - version = strings.TrimPrefix(c.Args().Get(0), "v") + // Fixes scenario where an incompatible semver is provided to lerna, which will cause the step to fail. + // When there is an invalid semver, a frontend package won't be published anyways. + if strings.Count(version, ".") == 2 { + version = strings.TrimPrefix(c.Args().Get(0), "v") + } } cfg, mode, err := frontend.GetConfig(c, version)