mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
add support for opencontainers meta labels
This commit is contained in:
parent
9f60766692
commit
77a46ab3bd
8 changed files with 125 additions and 5 deletions
|
|
@ -5,6 +5,8 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
|
||||
t "github.com/containrrr/watchtower/pkg/types"
|
||||
)
|
||||
|
||||
|
|
@ -66,6 +68,11 @@ func (client MockClient) RemoveImageByID(_ t.ImageID) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetImage is a mock method
|
||||
func (client MockClient) GetImage(_ t.ImageID) (dockerTypes.ImageInspect, error) {
|
||||
return dockerTypes.ImageInspect{}, nil
|
||||
}
|
||||
|
||||
// GetContainer is a mock method
|
||||
func (client MockClient) GetContainer(_ t.ContainerID) (t.Container, error) {
|
||||
return client.TestData.Containers[0], nil
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func Update(client container.Client, params types.UpdateParams) (types.Report, e
|
|||
staleCheckFailed := 0
|
||||
|
||||
for i, targetContainer := range containers {
|
||||
stale, newestImage, err := client.IsContainerStale(targetContainer)
|
||||
stale, newestImageID, err := client.IsContainerStale(targetContainer)
|
||||
shouldUpdate := stale && !params.NoRestart && !params.MonitorOnly && !targetContainer.IsMonitorOnly()
|
||||
if err == nil && shouldUpdate {
|
||||
// Check to make sure we have all the necessary information for recreating the container
|
||||
|
|
@ -55,12 +55,15 @@ func Update(client container.Client, params types.UpdateParams) (types.Report, e
|
|||
staleCheckFailed++
|
||||
progress.AddSkipped(targetContainer, err)
|
||||
} else {
|
||||
progress.AddScanned(targetContainer, newestImage)
|
||||
progress.AddScanned(targetContainer, newestImageID)
|
||||
}
|
||||
containers[i].SetStale(stale)
|
||||
|
||||
if stale {
|
||||
staleCount++
|
||||
if latestImage, err := client.GetImage(newestImageID); err == nil {
|
||||
progress.UpdateLatestImage(targetContainer.ID(), latestImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue