fix: allow cron aliases in schedule validation#16100
Open
PradeepSD476 wants to merge 1 commit into
Open
Conversation
CronWorkflow validation rejected valid cron aliases such as JAN and MON-FRI even though they are supported by the runtime cron parser. Updated the schedule validation regex to allow alphabetic cron aliases while semantic validation continues to be handled by the cron parser. Fixes argoproj#16052 Signed-off-by: Pradeep Sagitra <sagitrapradeep2006@gmail.com>
MasonM
approved these changes
May 26, 2026
Member
MasonM
left a comment
There was a problem hiding this comment.
Thanks, this looks right to me. Here's the list of the aliases the parser allows: https://github.com/robfig/cron/blob/bc59245fe10efaed9d51b56900192527ed733435/spec.go#L26-L48
This could be made stricter, but that doesn't seem necessary to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16052
Motivation
CronWorkflow validation rejected valid cron aliases such as Jan and Mon-Fri even though they are supported by the runtime cron parser.
Modifications
Updated the validation regex to allow alphabetic cron aliases in CronWorkflow schedules.
This keeps semantic validation delegated to the runtime cron parser while preventing valid aliases from being rejected during CRD validation.
Verification
Verified the following schedules successfully:
*/1 * * May Fri-Sat
0 0 * * MON-FRI
0 8 3 JAN *
Also verified invalid aliases such as May,Hello are rejected by the runtime cron parser with a message: cron schedule */1 * * May,Hello Fri,Sat is malformed: failed to parse int from Hello: strconv.Atoi: parsing "Hello": invalid syntax.
Documentation
No documentation changes were required.
AI
Used ChatGPT for debugging discussion and PR preparation.