diff --git a/cmd/flux/version_utils.go b/cmd/flux/version_utils.go index 8f64ebf3..64b52ccf 100644 --- a/cmd/flux/version_utils.go +++ b/cmd/flux/version_utils.go @@ -18,6 +18,7 @@ package main import ( "fmt" + "strings" "github.com/fluxcd/flux2/internal/utils" "github.com/fluxcd/flux2/pkg/manifestgen/install" @@ -28,6 +29,10 @@ func getVersion(input string) (string, error) { return rootArgs.defaults.Version, nil } + if input != install.MakeDefaultOptions().Version && !strings.HasPrefix(input, "v") { + return "", fmt.Errorf("targeted version '%s' must be prefixed with 'v'", input) + } + if isEmbeddedVersion(input) { return input, nil }