diff --git a/doc/configuration.md b/doc/configuration.md index b60122a9..9b89e019 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -8,7 +8,7 @@ db: watch: workers: 10 - schedule: "0 0 * * * *" + schedule: "0 * * * *" notif: mail: @@ -79,7 +79,7 @@ image: * `watch` * `workers`: Maximum number of workers that will execute tasks concurrently. _Optional_. (default: `10`). - * `schedule`: [CRON expression](https://godoc.org/github.com/crazy-max/cron#hdr-CRON_Expression_Format) to schedule Diun watcher. _Optional_. (default: `0 0 * * * *`). + * `schedule`: [CRON expression](https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format) to schedule Diun watcher. _Optional_. (default: `0 * * * *`). ## notif diff --git a/internal/app/diun.go b/internal/app/diun.go index 65e7844d..1a19fa67 100644 --- a/internal/app/diun.go +++ b/internal/app/diun.go @@ -41,8 +41,10 @@ func New(cfg *config.Config, location *time.Location) (*Diun, error) { } return &Diun{ - cfg: cfg, - cron: cron.New(cron.WithLocation(location), cron.WithSeconds()), + cfg: cfg, + cron: cron.New(cron.WithLocation(location), cron.WithParser(cron.NewParser( + cron.SecondOptional|cron.Minute|cron.Hour|cron.Dom|cron.Month|cron.Dow|cron.Descriptor), + )), db: dbcli, notif: notifcli, }, nil diff --git a/internal/config/config.go b/internal/config/config.go index 9ca9690e..3a2502ca 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -46,7 +46,7 @@ func Load(flags model.Flags, version string) (*Config, error) { }, Watch: model.Watch{ Workers: 10, - Schedule: "0 0 * * * *", + Schedule: "0 * * * *", }, Notif: model.Notif{ Mail: model.Mail{ diff --git a/internal/config/config.test.yml b/internal/config/config.test.yml index 8fb8df95..db66efd8 100644 --- a/internal/config/config.test.yml +++ b/internal/config/config.test.yml @@ -3,7 +3,7 @@ db: watch: workers: 100 - schedule: "*/30 * * * * *" + schedule: "*/30 * * * *" notif: mail: @@ -33,32 +33,44 @@ regopts: password: bar image: - - name: docker.io/crazymax/nextcloud:latest + - + name: docker.io/crazymax/nextcloud:latest regopts_id: someregopts - - name: crazymax/swarm-cronjob + - + name: crazymax/swarm-cronjob watch_repo: true include_tags: - ^1\.2\..* - - name: jfrog-docker-reg2.bintray.io/jfrog/artifactory-oss:4.0.0 + - + name: jfrog-docker-reg2.bintray.io/jfrog/artifactory-oss:4.0.0 regopts_id: bintrayoptions - - name: docker.bintray.io/jfrog/xray-server:2.8.6 + - + name: docker.bintray.io/jfrog/xray-server:2.8.6 watch_repo: true max_tags: 50 - - name: quay.io/coreos/hyperkube - - name: docker.io/portainer/portainer + - + name: quay.io/coreos/hyperkube + - + name: docker.io/portainer/portainer watch_repo: true max_tags: 10 include_tags: - ^(0|[1-9]\d*)\..* - - name: traefik + - + name: traefik watch_repo: true - - name: alpine + - + name: alpine os: linux arch: arm64v8 - - name: docker.io/graylog/graylog:3.2.0 - - name: jacobalberty/unifi:5.9 - - name: quay.io/coreos/hyperkube:v1.1.7-coreos.1 - - name: crazymax/ddns-route53 + - + name: docker.io/graylog/graylog:3.2.0 + - + name: jacobalberty/unifi:5.9 + - + name: quay.io/coreos/hyperkube:v1.1.7-coreos.1 + - + name: crazymax/ddns-route53 watch_repo: true include_tags: - ^1\..* diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 481c3bc0..8d278c72 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -49,7 +49,7 @@ func TestLoad(t *testing.T) { }, Watch: model.Watch{ Workers: 100, - Schedule: "*/30 * * * * *", + Schedule: "*/30 * * * *", }, Notif: model.Notif{ Mail: model.Mail{