mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 22:20:12 +01:00
Setup a working pipeline
* add tests to ensure function even after switching docker client api version * switch docker client api version to remove import of Sirupsen and get rid of the casing workaround * migrate from glide to dep to go modules * rewrite ci workflow * only run publish on version tags * only run build on branches * update goreleaser config * disable automated latest tag push * remove dependency to v2tec/docker-gobuilder * remove dead code and files * add golands .idea folder to gitignore * add label to released docker images * add test reporting, add some unit tests * change test output dir * fix goreleaser versions * add debug output for circleci and goreleaser * disable cgo
This commit is contained in:
parent
98f916f29a
commit
1b82da1ab7
16 changed files with 450 additions and 362 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
dockercontainer "github.com/docker/docker/api/types/container"
|
||||
)
|
||||
|
|
@ -102,8 +102,9 @@ func (c Container) Links() []string {
|
|||
// identified by the presence of the "com.centurylinklabs.watchtower" label in
|
||||
// the container metadata.
|
||||
func (c Container) IsWatchtower() bool {
|
||||
val, ok := c.containerInfo.Config.Labels[watchtowerLabel]
|
||||
return ok && val == "true"
|
||||
log.Debugf("Checking if %s is a watchtower instance.", c.Name())
|
||||
wasWatchtower := ContainsWatchtowerLabel(c.containerInfo.Config.Labels)
|
||||
return wasWatchtower
|
||||
}
|
||||
|
||||
// StopSignal returns the custom stop signal (if any) that is encoded in the
|
||||
|
|
@ -182,3 +183,10 @@ func (c Container) hostConfig() *dockercontainer.HostConfig {
|
|||
|
||||
return hostConfig
|
||||
}
|
||||
|
||||
// ContainsWatchtowerLabel takes a map of labels and values and tells
|
||||
// the consumer whether it contains a valid watchtower instance label
|
||||
func ContainsWatchtowerLabel(labels map[string]string) bool {
|
||||
val, ok := labels[watchtowerLabel]
|
||||
return ok && val == "true"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue