Validate if only 1 image policy selector is given
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@@ -102,7 +102,9 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case imagePolicyArgs.semver != "" && imagePolicyArgs.alpha != "":
|
case imagePolicyArgs.semver != "" && imagePolicyArgs.alpha != "":
|
||||||
return fmt.Errorf("policy cannot be specified with both --select-semver and --select-alpha")
|
case imagePolicyArgs.semver != "" && imagePolicyArgs.numeric != "":
|
||||||
|
case imagePolicyArgs.alpha != "" && imagePolicyArgs.numeric != "":
|
||||||
|
return fmt.Errorf("only one of --select-semver, --select-alpha or --select-numeric can be specified")
|
||||||
case imagePolicyArgs.semver != "":
|
case imagePolicyArgs.semver != "":
|
||||||
policy.Spec.Policy.SemVer = &imagev1.SemVerPolicy{
|
policy.Spec.Policy.SemVer = &imagev1.SemVerPolicy{
|
||||||
Range: imagePolicyArgs.semver,
|
Range: imagePolicyArgs.semver,
|
||||||
|
|||||||
Reference in New Issue
Block a user