mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
Pre-update lifecycle hook (#793)
* Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Make watchtower skip update if pre-update lifecycle hook exits with a non-zero exit code #649 * Prevent starting new container if old one is not stopped because of lifecycle hook. * Add null check for c.containerInfo.State in IsRunning * Fixed that the container would not start * Added test for preupdate * EX_TEMPFAIL -> ExTempFail * Added missing fuction ouput names * Skip preupdate when container is restarting.
This commit is contained in:
parent
dc12a1ac7f
commit
145fe6dbcb
8 changed files with 281 additions and 39 deletions
|
@ -65,13 +65,20 @@ func CreateMockContainerWithDigest(id string, name string, image string, created
|
|||
}
|
||||
|
||||
// CreateMockContainerWithConfig creates a container substitute valid for testing
|
||||
func CreateMockContainerWithConfig(id string, name string, image string, created time.Time, config *container2.Config) container.Container {
|
||||
func CreateMockContainerWithConfig(id string, name string, image string, running bool, restarting bool, created time.Time, config *container2.Config) container.Container {
|
||||
content := types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
ID: id,
|
||||
Image: image,
|
||||
Name: name,
|
||||
ID: id,
|
||||
Image: image,
|
||||
Name: name,
|
||||
State: &types.ContainerState{
|
||||
Running: running,
|
||||
Restarting: restarting,
|
||||
},
|
||||
Created: created.String(),
|
||||
HostConfig: &container2.HostConfig{
|
||||
PortBindings: map[nat.Port][]nat.PortBinding{},
|
||||
},
|
||||
},
|
||||
Config: config,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue