-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use UTC as default timezone when schedule Actions cron tasks #31742
Conversation
} | ||
|
||
// If the spec has specified a timezone, use it | ||
if strings.HasPrefix(s.Spec, "TZ=") || strings.HasPrefix(s.Spec, "CRON_TZ=") { |
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.
How do we handle leading whitespace?
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.
It's not "we", it's how "robfig/cron" handle this.
https://github.com/robfig/cron/blob/bc59245fe10efaed9d51b56900192527ed733435/parser.go#L95
If we want to handle leading whitespace, it could be done before storing it into the database.
* giteaofficial/main: Clear up old Actions logs (go-gitea#31735) Fix createElementFromAttrs bug (go-gitea#31751) bump vue-bar-graph (go-gitea#31705) Use UTC as default timezone when schedule Actions cron tasks (go-gitea#31742) Add permission description for API to add repo collaborator (go-gitea#31744) Clarify Actions resources ownership (go-gitea#31724) Exclude protected branches from recently pushed (go-gitea#31748) [skip ci] Updated translations via Crowdin Distinguish LFS object errors to ignore missing objects during migration (go-gitea#31702)
Fix #31657.
According to the doc of GitHub Actions, The timezone for cron should be UTC, not the local timezone. And Gitea Actions doesn't have any reasons to change this, so I think it's a bug.
However, Gitea Actions has extended the syntax, as it supports descriptors like
@weekly
and@every 5m
, and supports specifying the timezone likeTZ=UTC 0 10 * * *
. So we can make it use UTC only when the timezone is not specified, to be compatible with GitHub Actions, and also respect the user's specified.It does break the feature because the times to run tasks would be changed, and it may confuse users. So I don't think we should backport this.
If the server's local time zone is not UTC, a scheduled task would run at a different time after upgrading Gitea to this version.