mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-20 06:31:47 +00:00
Merge pull request #3024 from fluxcd/validate-version
Add version validation to install commands
This commit is contained in:
commit
f880cce4f9
1 changed files with 5 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/fluxcd/flux2/internal/utils"
|
"github.com/fluxcd/flux2/internal/utils"
|
||||||
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
"github.com/fluxcd/flux2/pkg/manifestgen/install"
|
||||||
|
|
@ -28,6 +29,10 @@ func getVersion(input string) (string, error) {
|
||||||
return rootArgs.defaults.Version, nil
|
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) {
|
if isEmbeddedVersion(input) {
|
||||||
return input, nil
|
return input, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue