Validate if only 1 image policy selector is given

Signed-off-by: Hidde Beydals <hello@hidde.co>
pull/911/head
Hidde Beydals 4 years ago
parent e4c3136433
commit 73b8a26850

@ -102,7 +102,9 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error {
switch {
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 != "":
policy.Spec.Policy.SemVer = &imagev1.SemVerPolicy{
Range: imagePolicyArgs.semver,

Loading…
Cancel
Save