mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-18 05:31:48 +00:00
Add version validation to install commands
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
c56f338b12
commit
8a0fd6ddf9
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