mirror of
https://github.com/containrrr/watchtower.git
synced 2026-03-01 18:30:17 +01:00
Add metrics and progress report capabilities for deferred items seperate from other statuses
This commit is contained in:
parent
48bfaef350
commit
3c0441b94c
10 changed files with 84 additions and 43 deletions
|
|
@ -72,6 +72,8 @@ func (pb *previewData) addContainer(c containerStatus) {
|
|||
pb.report.scanned = append(pb.report.scanned, &c)
|
||||
case UpdatedState:
|
||||
pb.report.updated = append(pb.report.updated, &c)
|
||||
case DeferredState:
|
||||
pb.report.deferred = append(pb.report.deferred, &c)
|
||||
case FailedState:
|
||||
pb.report.failed = append(pb.report.failed, &c)
|
||||
case SkippedState:
|
||||
|
|
|
|||
|
|
@ -10,12 +10,13 @@ import (
|
|||
type State string
|
||||
|
||||
const (
|
||||
ScannedState State = "scanned"
|
||||
UpdatedState State = "updated"
|
||||
FailedState State = "failed"
|
||||
SkippedState State = "skipped"
|
||||
StaleState State = "stale"
|
||||
FreshState State = "fresh"
|
||||
ScannedState State = "scanned"
|
||||
UpdatedState State = "updated"
|
||||
DeferredState State = "deferred"
|
||||
FailedState State = "failed"
|
||||
SkippedState State = "skipped"
|
||||
StaleState State = "stale"
|
||||
FreshState State = "fresh"
|
||||
)
|
||||
|
||||
// StatesFromString parses a string of state characters and returns a slice of the corresponding report states
|
||||
|
|
@ -27,6 +28,8 @@ func StatesFromString(str string) []State {
|
|||
states = append(states, ScannedState)
|
||||
case 'u':
|
||||
states = append(states, UpdatedState)
|
||||
case 'd':
|
||||
states = append(states, DeferredState)
|
||||
case 'e':
|
||||
states = append(states, FailedState)
|
||||
case 'k':
|
||||
|
|
@ -43,12 +46,13 @@ func StatesFromString(str string) []State {
|
|||
}
|
||||
|
||||
type report struct {
|
||||
scanned []types.ContainerReport
|
||||
updated []types.ContainerReport
|
||||
failed []types.ContainerReport
|
||||
skipped []types.ContainerReport
|
||||
stale []types.ContainerReport
|
||||
fresh []types.ContainerReport
|
||||
scanned []types.ContainerReport
|
||||
updated []types.ContainerReport
|
||||
deferred []types.ContainerReport
|
||||
failed []types.ContainerReport
|
||||
skipped []types.ContainerReport
|
||||
stale []types.ContainerReport
|
||||
fresh []types.ContainerReport
|
||||
}
|
||||
|
||||
func (r *report) Scanned() []types.ContainerReport {
|
||||
|
|
@ -57,6 +61,9 @@ func (r *report) Scanned() []types.ContainerReport {
|
|||
func (r *report) Updated() []types.ContainerReport {
|
||||
return r.updated
|
||||
}
|
||||
func (r *report) Deferred() []types.ContainerReport {
|
||||
return r.deferred
|
||||
}
|
||||
func (r *report) Failed() []types.ContainerReport {
|
||||
return r.failed
|
||||
}
|
||||
|
|
@ -87,6 +94,7 @@ func (r *report) All() []types.ContainerReport {
|
|||
}
|
||||
|
||||
appendUnique(r.updated)
|
||||
appendUnique(r.deferred)
|
||||
appendUnique(r.failed)
|
||||
appendUnique(r.skipped)
|
||||
appendUnique(r.stale)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue