Add comments that describe original image info overwriting

pull/1978/head
Amin Faez 4 weeks ago
parent 85ea00f3ad
commit ebe3fafeef

@ -329,10 +329,12 @@ func (client dockerClient) IsContainerStale(container t.Container, params t.Upda
}
func (client dockerClient) HasNewImage(ctx context.Context, container t.Container) (hasNew bool, latestImage t.ImageID, err error) {
currentImageID := t.ImageID(container.ContainerInfo().ContainerJSONBase.Image)
container_info := container.ContainerInfo()
currentImageID := t.ImageID(container_info.ContainerJSONBase.Image)
imageName := container.ImageName()
imageIDSetByLabel, ok := container.ContainerInfo().Config.Labels[originalImageIDLabel]
// If the original-image-id label is set, it overwrites the image id reported by docker
imageIDSetByLabel, ok := container_info.Config.Labels[originalImageIDLabel]
if ok {
currentImageID = t.ImageID(imageIDSetByLabel)
log.Infof("Original image id for %s found: (%s)", imageName, currentImageID.ShortID())

@ -103,7 +103,11 @@ func (c Container) SafeImageID() wt.ImageID {
// "latest" tag is assumed.
func (c Container) ImageName() string {
// Compatibility w/ Zodiac deployments
imageName, ok := c.getLabelValue(originalImageNameLabel)
imageName, ok := c.getLabelValue(zodiacLabel)
// If the original-image-name label is set, it overwrites the image name reported by docker
if !ok {
imageName, ok = c.getLabelValue(originalImageNameLabel)
}
if !ok {
imageName = c.containerInfo.Config.Image
}

Loading…
Cancel
Save