|
|
@ -40,6 +40,7 @@ the status of the object.`,
|
|
|
|
type imagePolicyFlags struct {
|
|
|
|
type imagePolicyFlags struct {
|
|
|
|
imageRef string
|
|
|
|
imageRef string
|
|
|
|
semver string
|
|
|
|
semver string
|
|
|
|
|
|
|
|
filterRegex string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var imagePolicyArgs = imagePolicyFlags{}
|
|
|
|
var imagePolicyArgs = imagePolicyFlags{}
|
|
|
@ -48,6 +49,7 @@ func init() {
|
|
|
|
flags := createImagePolicyCmd.Flags()
|
|
|
|
flags := createImagePolicyCmd.Flags()
|
|
|
|
flags.StringVar(&imagePolicyArgs.imageRef, "image-ref", "", "the name of an image repository object")
|
|
|
|
flags.StringVar(&imagePolicyArgs.imageRef, "image-ref", "", "the name of an image repository object")
|
|
|
|
flags.StringVar(&imagePolicyArgs.semver, "semver", "", "a semver range to apply to tags; e.g., '1.x'")
|
|
|
|
flags.StringVar(&imagePolicyArgs.semver, "semver", "", "a semver range to apply to tags; e.g., '1.x'")
|
|
|
|
|
|
|
|
flags.StringVar(&imagePolicyArgs.filterRegex, "filter-regex", "", " regular expression pattern used to filter the image tags")
|
|
|
|
|
|
|
|
|
|
|
|
createImageCmd.AddCommand(createImagePolicyCmd)
|
|
|
|
createImageCmd.AddCommand(createImagePolicyCmd)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -95,6 +97,12 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error {
|
|
|
|
return fmt.Errorf("a policy must be provided with --semver")
|
|
|
|
return fmt.Errorf("a policy must be provided with --semver")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if imagePolicyArgs.filterRegex != "" {
|
|
|
|
|
|
|
|
policy.Spec.FilterTags = &imagev1.TagFilter{
|
|
|
|
|
|
|
|
Pattern: imagePolicyArgs.filterRegex,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if export {
|
|
|
|
if export {
|
|
|
|
return printExport(exportImagePolicy(&policy))
|
|
|
|
return printExport(exportImagePolicy(&policy))
|
|
|
|
}
|
|
|
|
}
|
|
|
|