Skip to content

Update only specific containers #1745

@jebabin

Description

@jebabin

Is your feature request related to a problem? Please describe.

I'd like to be able to globally disable containers update but enable update for a specific container.

Currently, it's possible to disable globally containers update with WATCHTOWER_MONITOR_ONLY
But, unless i missed something, when WATCHTOWER_MONITOR_ONLY is set to true, there is no way to enable update for a specific container

The only way would be to set com.centurylinklabs.watchtower.monitor-only to true on all containers except the one that need to be update.

Describe the solution you'd like

Instead of having update enable by default then disable update on some containers, I'd like to have update disable by default then enable update on some contrainers

Describe alternatives you've considered

set com.centurylinklabs.watchtower.monitor-only to true on all containers except the one that need to be update.

Additional context

May be in case WATCHTOWER_MONITOR_ONLY=true && com.centurylinklabs.watchtower.monitor-only=false the update could be performed ?
It would imply to default com.centurylinklabs.watchtower.monitor-only to true when WATCHTOWER_MONITOR_ONLY=true

May be the following changes would do this
in update.go (line 37), changing
shouldUpdate := stale && !params.NoRestart && !params.MonitorOnly && !targetContainer.IsMonitorOnly()
to something like
shouldUpdate := stale && !params.NoRestart && !targetContainer.IsMonitorOnly()
in update.go (line 75), removing
if !params.MonitorOnly {

in container.go (line 134), changing

func (c Container) IsMonitorOnly() bool {
	rawBool, ok := c.getLabelValue(monitorOnlyLabel)
	if !ok {
		return false
	}

	parsedBool, err := strconv.ParseBool(rawBool)
	if err != nil {
		return false
	}

	return parsedBool
}

to


func (c Container) IsMonitorOnly() bool {
	rawBool, ok := c.getLabelValue(monitorOnlyLabel)
	if !ok {
		if params.MonitorOnly {
			return true
		} else {
			return false
		}
	}

	parsedBool, err := strconv.ParseBool(rawBool)
	if err != nil {
		if params.MonitorOnly {
			return true
		} else {
			return false
		}
	}

	return parsedBool
}

but params is not defined in containers.go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions