Change parameter name from delay-days to defer-days to be clearer to user and align with status reporting

This commit is contained in:
Peter Wilhelm 2024-01-07 17:59:10 -06:00
parent 0d1d7979cb
commit 223358f7a0
4 changed files with 16 additions and 15 deletions

View file

@ -39,7 +39,7 @@ var (
disableContainers []string disableContainers []string
notifier t.Notifier notifier t.Notifier
timeout time.Duration timeout time.Duration
delayDays int deferDays int
lifecycleHooks bool lifecycleHooks bool
rollingRestart bool rollingRestart bool
scope string scope string
@ -97,7 +97,7 @@ func PreRun(cmd *cobra.Command, _ []string) {
enableLabel, _ = f.GetBool("label-enable") enableLabel, _ = f.GetBool("label-enable")
disableContainers, _ = f.GetStringSlice("disable-containers") disableContainers, _ = f.GetStringSlice("disable-containers")
delayDays, _ = f.GetInt("delay-days") deferDays, _ = f.GetInt("defer-days")
lifecycleHooks, _ = f.GetBool("enable-lifecycle-hooks") lifecycleHooks, _ = f.GetBool("enable-lifecycle-hooks")
rollingRestart, _ = f.GetBool("rolling-restart") rollingRestart, _ = f.GetBool("rolling-restart")
scope, _ = f.GetString("scope") scope, _ = f.GetString("scope")
@ -290,9 +290,9 @@ func writeStartupMessage(c *cobra.Command, sched time.Time, filtering string) {
until := formatDuration(time.Until(sched)) until := formatDuration(time.Until(sched))
startupLog.Info("Scheduling first run: " + sched.Format("2006-01-02 15:04:05 -0700 MST")) startupLog.Info("Scheduling first run: " + sched.Format("2006-01-02 15:04:05 -0700 MST"))
startupLog.Info("Note that the first check will be performed in " + until) startupLog.Info("Note that the first check will be performed in " + until)
delayDays, _ = c.PersistentFlags().GetInt("delay-days") deferDays, _ = c.PersistentFlags().GetInt("defer-days")
if delayDays > 0 { if deferDays > 0 {
startupLog.Infof("Container updates will be delayed until %d day(s) after image creation.", delayDays) startupLog.Infof("Container updates will be deferred until %d day(s) after image creation.", deferDays)
} }
} else if runOnce, _ := c.PersistentFlags().GetBool("run-once"); runOnce { } else if runOnce, _ := c.PersistentFlags().GetBool("run-once"); runOnce {
startupLog.Info("Running a one time update.") startupLog.Info("Running a one time update.")
@ -370,7 +370,7 @@ func runUpdatesWithNotifications(filter t.Filter) *metrics.Metric {
NoRestart: noRestart, NoRestart: noRestart,
Timeout: timeout, Timeout: timeout,
MonitorOnly: monitorOnly, MonitorOnly: monitorOnly,
DelayDays: delayDays, DeferDays: deferDays,
LifecycleHooks: lifecycleHooks, LifecycleHooks: lifecycleHooks,
RollingRestart: rollingRestart, RollingRestart: rollingRestart,
LabelPrecedence: labelPrecedence, LabelPrecedence: labelPrecedence,
@ -383,9 +383,10 @@ func runUpdatesWithNotifications(filter t.Filter) *metrics.Metric {
notifier.SendNotification(result) notifier.SendNotification(result)
metricResults := metrics.NewMetric(result) metricResults := metrics.NewMetric(result)
notifications.LocalLog.WithFields(log.Fields{ notifications.LocalLog.WithFields(log.Fields{
"Scanned": metricResults.Scanned, "Scanned": metricResults.Scanned,
"Updated": metricResults.Updated, "Updated": metricResults.Updated,
"Failed": metricResults.Failed, "Deferred": metricResults.Deferred,
"Failed": metricResults.Failed,
}).Info("Session done") }).Info("Session done")
return metricResults return metricResults
} }

View file

@ -381,12 +381,12 @@ Environment Variable: WATCHTOWER_HTTP_API_METRICS
Default: false Default: false
``` ```
## Delayed Update ## Deferred Update
Only update container to latest version of image if some number of days have passed since it has been published. This option may be useful for those who wish to avoid updating prior to the new version having some time in the field prior to updating in case there are critical defects found and released in a subsequent version. Only update container to latest version of image if some number of days have passed since it has been published. This option may be useful for those who wish to avoid updating prior to the new version having some time in the field prior to updating in case there are critical defects found and released in a subsequent version.
```text ```text
Argument: --delay-days Argument: --defer-days
Environment Variable: WATCHTOWER_DELAY_DAYS Environment Variable: WATCHTOWER_DEFER_DAYS
Type: Integer Type: Integer
Default: false Default: false
``` ```

View file

@ -148,9 +148,9 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
"Enable the execution of commands triggered by pre- and post-update lifecycle hooks") "Enable the execution of commands triggered by pre- and post-update lifecycle hooks")
flags.IntP( flags.IntP(
"delay-days", "defer-days",
"0", "0",
envInt("WATCHTOWER_DELAY_DAYS"), envInt("WATCHTOWER_DEFER_DAYS"),
"Number of days to wait for new image version to be in place prior to installing it") "Number of days to wait for new image version to be in place prior to installing it")
flags.BoolP( flags.BoolP(

View file

@ -12,7 +12,7 @@ type UpdateParams struct {
Timeout time.Duration Timeout time.Duration
MonitorOnly bool MonitorOnly bool
NoPull bool NoPull bool
DelayDays int DeferDays int
LifecycleHooks bool LifecycleHooks bool
RollingRestart bool RollingRestart bool
LabelPrecedence bool LabelPrecedence bool