- Notifications
You must be signed in to change notification settings - Fork928
autostart/autostop: move to traditional 5-valued cron string for compatibility#1049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ules, automatically set timezone
codecovbot commentedApr 16, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## main #1049 +/- ##==========================================+ Coverage 67.31% 67.45% +0.13%========================================== Files 259 259 Lines 15061 15100 +39 Branches 152 152 ==========================================+ Hits 10139 10185 +46+ Misses 3899 3896 -3+ Partials 1023 1019 -4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Minor nits. LGTM
Uh oh!
There was an error while loading.Please reload this page.
RunE: func(cmd *cobra.Command, args []string) error { | ||
client, err := createClient(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
workspace, err := client.WorkspaceByName(cmd.Context(), codersdk.Me, args[0]) | ||
spec := fmt.Sprintf("CRON_TZ=%s %s %s * * %s", autostartTimezone, autostartMinute, autostartHour, autostartDayOfWeek) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
praise: nice!
Uh oh!
There was an error while loading.Please reload this page.
tzEnv := os.Getenv("TZ") | ||
if tzEnv == "" { | ||
tzEnv = "UTC" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
praise: nice 😎
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cli/workspaceautostop.go Outdated
cmd.Flags().StringVar(&autostopMinute, "minute", "0", "autostop minute") | ||
cmd.Flags().StringVar(&autostopHour, "hour", "18", "autostop hour") | ||
cmd.Flags().StringVar(&autostopDayOfWeek, "dow", "1-5", "autostop hour") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
cmd.Flags().StringVar(&autostopDayOfWeek,"dow","1-5","autostophour") | |
cmd.Flags().StringVar(&autostopDayOfWeek,"dow","1-5","autostopday(s) of week") |
at: time.Time{}, | ||
expectedNext: time.Time{}, | ||
expectedError: "validate weekly schedule: expected month and dom to be *", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
praise: Great tests
greyscaled commentedApr 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@johnstcn we're seeing a parse failure in our Storybook. I think we need to update these here to have coder/site/src/test_helpers/entities.ts Lines 64 to 81 inf2904f6
|
ack |
This PR modfies the original 3-valued cron strings used in package
schedule
to be traditional 5-valued cron strings.schedule.Weekly
will validate that themonth
anddom
fields are equal to*
TZ
env var, defaulting to UTC--minute
,--hour
,--dow
, and--tz
arguments. Default schedules are provided that should suffice for most users.Fixes#993