mirror of
https://github.com/containrrr/watchtower.git
synced 2026-03-11 07:02:35 +01:00
Merge branch 'master' into feat/240-implement-other-slack-options
This commit is contained in:
commit
3f9ec033e1
24 changed files with 572 additions and 419 deletions
24
main.go
24
main.go
|
|
@ -1,4 +1,4 @@
|
|||
package main // import "github.com/v2tec/watchtower"
|
||||
package main // import "github.com/containrrr/watchtower"
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
|
@ -11,9 +11,9 @@ import (
|
|||
"github.com/robfig/cron"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/v2tec/watchtower/actions"
|
||||
"github.com/v2tec/watchtower/container"
|
||||
"github.com/v2tec/watchtower/notifications"
|
||||
"github.com/containrrr/watchtower/actions"
|
||||
"github.com/containrrr/watchtower/container"
|
||||
"github.com/containrrr/watchtower/notifications"
|
||||
)
|
||||
|
||||
// DockerAPIMinVersion is the version of the docker API, which is minimally required by
|
||||
|
|
@ -29,6 +29,7 @@ var (
|
|||
scheduleSpec string
|
||||
cleanup bool
|
||||
noRestart bool
|
||||
monitorOnly bool
|
||||
enableLabel bool
|
||||
notifier *notifications.Notifier
|
||||
timeout time.Duration
|
||||
|
|
@ -186,6 +187,11 @@ func main() {
|
|||
Usage: "The MSTeams notifier will try to extract log entry fields as MSTeams message facts",
|
||||
EnvVar: "WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "monitor-only",
|
||||
Usage: "Will only monitor for new images, not update the containers",
|
||||
EnvVar: "WATCHTOWER_MONITOR_ONLY",
|
||||
},
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
|
|
@ -211,6 +217,7 @@ func before(c *cli.Context) error {
|
|||
|
||||
cleanup = c.GlobalBool("cleanup")
|
||||
noRestart = c.GlobalBool("no-restart")
|
||||
monitorOnly = c.GlobalBool("monitor-only")
|
||||
timeout = c.GlobalDuration("stop-timeout")
|
||||
if timeout < 0 {
|
||||
log.Fatal("Please specify a positive value for timeout value.")
|
||||
|
|
@ -249,7 +256,14 @@ func start(c *cli.Context) error {
|
|||
case v := <-tryLockSem:
|
||||
defer func() { tryLockSem <- v }()
|
||||
notifier.StartNotification()
|
||||
if err := actions.Update(client, filter, cleanup, noRestart, timeout); err != nil {
|
||||
updateParams := actions.UpdateParams{
|
||||
Filter: filter,
|
||||
Cleanup: cleanup,
|
||||
NoRestart: noRestart,
|
||||
Timeout: timeout,
|
||||
MonitorOnly: monitorOnly,
|
||||
}
|
||||
if err := actions.Update(client, updateParams); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
notifier.SendNotification()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue