mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
feat: support container network mode (#1429)
Co-authored-by: nils måsén <nils@piksel.se> Co-authored-by: Andreas Åhman <andreas.ahman@ingka.ikea.com>
This commit is contained in:
parent
bba9b2b100
commit
dca45f50cb
15 changed files with 1379 additions and 47 deletions
42
pkg/container/mocks/container_ref.go
Normal file
42
pkg/container/mocks/container_ref.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package mocks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
t "github.com/containrrr/watchtower/pkg/types"
|
||||
)
|
||||
|
||||
type imageRef struct {
|
||||
id t.ImageID
|
||||
file string
|
||||
}
|
||||
|
||||
func (ir *imageRef) getFileName() string {
|
||||
return fmt.Sprintf("./mocks/data/image_%v.json", ir.file)
|
||||
}
|
||||
|
||||
type ContainerRef struct {
|
||||
name string
|
||||
id t.ContainerID
|
||||
image *imageRef
|
||||
file string
|
||||
references []*ContainerRef
|
||||
isMissing bool
|
||||
}
|
||||
|
||||
func (cr *ContainerRef) getContainerFile() (containerFile string, err error) {
|
||||
file := cr.file
|
||||
if file == "" {
|
||||
file = cr.name
|
||||
}
|
||||
|
||||
containerFile = fmt.Sprintf("./mocks/data/container_%v.json", file)
|
||||
_, err = os.Stat(containerFile)
|
||||
|
||||
return containerFile, err
|
||||
}
|
||||
|
||||
func (cr *ContainerRef) ContainerID() t.ContainerID {
|
||||
return cr.id
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue