Merge pull request #3024 from fluxcd/validate-version
Add version validation to install commands
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user