fix: evaluate schedules in the cronjob's spec.timeZone (#428)
Unbound Release / Check Preconditions (push) Successful in 3s
Unbound Release / Create Tag (push) Skipped
Unbound Release / Create Release (push) Successful in 15s
Unbound Release / Generate Changelog and Handle PR (push) Successful in 17s
Release / release (push) Successful in 21s
cron-checker / test (push) Successful in 2m12s
cron-checker / vulnerabilities (push) Successful in 2m15s
cron-checker / build (push) Successful in 50s

Schedules were always evaluated in UTC because `schedule.Next` uses the location of `lastScheduleTime`, which the API returns in UTC. A CronJob with `spec.timeZone` set was therefore reported as not running every day. For example, Paidit's `prod/dayclose` runs at `0 7 * * *` Europe/Stockholm: it ran at 05:00Z, but cron-checker expected 07:00Z and alerted every minute from 09:02 local time.

- Convert `since` to the CronJob's `spec.timeZone` before computing the next run. CronJobs without a `timeZone` behave as before.
- An invalid time zone returns an error, the same way an invalid schedule does.
- Embed `time/tzdata`, because the image is `FROM scratch` and has no zoneinfo.
- Tests: an invalid time zone, and a time-zone case that fails without the fix.
- Bumped golang.org/x/net to v0.60.0. govulncheck was already failing on main with five x/net advisories, which blocks the build job.
- Bumped the go toolchain to 1.27.2 for eight stdlib advisories. This is the same change as Renovate #427, which will close once this is merged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01C8SW6vsbkrTKjLNatQ8JTg
Reviewed-on: https://gitea.unbound.se/unboundsoftware/cron-checker/pulls/428
This commit was merged in pull request #428.
This commit is contained in:
argoyle committed 2026-10-09 07:54:30 +00:00
1 parent 40311eaeaa
commit 52d52a222c
4 files changed
+88 -16

No files matched your search

+5 -5
View File
@@ -2,7 +2,7 @@ module gitlab.com/unboundsoftware/cron-checker
go 1.26.0
toolchain go1.27.1
toolchain go1.27.2
require (
github.com/alecthomas/kingpin/v2 v2.4.0
@@ -44,11 +44,11 @@ require (
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/net v0.57.0 // indirect
golang.org/x/net v0.60.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/term v0.45.0 // indirect
golang.org/x/text v0.40.0 // indirect
golang.org/x/sys v0.48.0 // indirect
golang.org/x/term v0.46.0 // indirect
golang.org/x/text v0.42.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect