Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: keep checking updates for containers excluded from automatic updates (#4181)
Kyle Mendell4eeb7d43d3c4
diff --git a/backend/internal/container/service.go b/backend/internal/container/service.goindex 3864c7fb4..405304cc8 100644--- a/backend/internal/container/service.go+++ b/backend/internal/container/service.go@@ -36,6 +36,7 @@ import ("github.com/getarcaneapp/arcane/backend/v2/pkg/projects""github.com/getarcaneapp/arcane/backend/v2/pkg/utils""github.com/getarcaneapp/arcane/backend/v2/pkg/utils/iconcatalog"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/utils/imageref"containertypes "github.com/getarcaneapp/arcane/types/v2/container""github.com/getarcaneapp/arcane/types/v2/containerregistry"imagetypes "github.com/getarcaneapp/arcane/types/v2/image"@@ -1640,7 +1641,8 @@ func (s *ContainerService) BuildSummaries(ctx context.Context, containers []contif policyErr != nil || resolved.Strategy == "tag" {key = "container::" + dc.ID}- if info, exists := updateInfoMap[key]; exists {+ // A shared image result must not surface for a container that opted out of checks.+ if info, exists := updateInfoMap[key]; exists && !imageref.IsUpdateCheckDisabled(dc.Labels) {summary.UpdateInfo = info}summary.RedeployDisabled = labels.ShouldDisableArcaneServerRedeploy(summary.Labels, summary.ID, currentContainerID, currentContainerErr)diff --git a/backend/internal/container/service_test.go b/backend/internal/container/service_test.goindex 00c8b903e..52963d15c 100644--- a/backend/internal/container/service_test.go+++ b/backend/internal/container/service_test.go@@ -600,6 +600,7 @@ func TestBuildSummariesUsesContainerTagPolicyUpdates(t *testing.T) {{ID: "unchecked", Image: "app:3.1.0", ImageID: "shared-image", Labels: map[string]string{strategyLabel: "tag"}},{ID: "digest", Image: "app:3.1.0", ImageID: "shared-image", Labels: map[string]string{strategyLabel: "digest"}},{ID: "opted-out", Names: []string{"/opted-out"}, Image: "app:3.1.0", ImageID: "shared-image", Labels: map[string]string{"com.getarcaneapp.arcane.updater": "false"}},+ {ID: "unmonitored", Image: "app:3.1.0", ImageID: "shared-image", Labels: map[string]string{"com.getarcaneapp.arcane.update-check": "false"}},}updates := map[string]*imagetypes.UpdateInfo{"shared-image": {HasUpdate: true, UpdateType: "digest"},@@ -616,6 +617,9 @@ func TestBuildSummariesUsesContainerTagPolicyUpdates(t *testing.T) {require.True(t, items[0].AutoUpdateEnabled, "containers without opt-out are eligible")require.False(t, items[4].AutoUpdateEnabled, "the updater label disables auto-update")+ require.Equal(t, "digest", items[4].UpdateInfo.UpdateType, "disabling automatic updates keeps check results visible")+ require.Nil(t, items[5].UpdateInfo, "the update-check label hides the shared image result")+ require.True(t, items[5].AutoUpdateEnabled, "the update-check label does not affect installation eligibility")encoded, err := json.Marshal(items[4])require.NoError(t, err)require.Contains(t, string(encoded), `"autoUpdateEnabled":false`, "false status must stay serialized")diff --git a/backend/internal/image/image.go b/backend/internal/image/image.goindex 913b5fa03..c8176587c 100644--- a/backend/internal/image/image.go+++ b/backend/internal/image/image.go@@ -36,7 +36,6 @@ import ("github.com/samber/hot""github.com/samber/mo""go.getarcane.app/updater"- "go.getarcane.app/updater/labels""go.getarcane.app/updater/pkg/utils/tagpolicy""golang.org/x/sync/errgroup""gorm.io/gorm"@@ -674,7 +673,7 @@ func (s *ImageService) GetUpdateInfoByContainers(ctx context.Context, containerspolicies := make(map[string]string, len(containers))for _, cnt := range containers {policy, policyErr := tagpolicy.Resolve(cnt.Image, updater.DefaultLabelPolicy().TagPolicy(cnt.Labels))- if (policyErr == nil && policy.Strategy == "digest") || labels.IsUpdateDisabled(cnt.Labels) {+ if (policyErr == nil && policy.Strategy == "digest") || imageref.IsUpdateCheckDisabled(cnt.Labels) {continue}containerIDs = append(containerIDs, cnt.ID)diff --git a/backend/internal/image/service_test.go b/backend/internal/image/service_test.goindex 112e778ed..d1ee4c5ea 100644--- a/backend/internal/image/service_test.go+++ b/backend/internal/image/service_test.go@@ -699,12 +699,17 @@ func TestImageServiceContainerTagUpdatesStayScoped(t *testing.T) {{"com.getarcaneapp.arcane.updater.strategy": "digest"},{"com.getarcaneapp.arcane.updater.strategy": "tag", "com.getarcaneapp.arcane.updater.constraint": "3.1.x"},{"com.getarcaneapp.arcane.updater.strategy": "tag", "com.getarcaneapp.arcane.updater.constraint": "3.x", "com.getarcaneapp.arcane.updater.tag-pattern": ".*"},- {"com.getarcaneapp.arcane.updater.strategy": "tag", "com.getarcaneapp.arcane.updater.constraint": "3.x", "com.getarcaneapp.arcane.updater": "false"},+ {"com.getarcaneapp.arcane.updater.strategy": "tag", "com.getarcaneapp.arcane.updater.constraint": "3.x", imageref.UpdateCheckLabel: "false"},} {checks, err := svc.GetUpdateInfoByContainers(t.Context(), []container.Summary{{ID: "first", Image: "example:3.1.0", Labels: currentLabels}, {ID: "second", Image: "example:3.1.0", Labels: secondLabels}})require.NoError(t, err)require.NotContains(t, checks, "first")require.Contains(t, checks, "second")}-+ // Disabling automatic installation does not change the monitoring policy,+ // so the stored check stays visible (#3532).+ installExcluded := map[string]string{"com.getarcaneapp.arcane.updater.strategy": "tag", "com.getarcaneapp.arcane.updater.constraint": "3.x", "com.getarcaneapp.arcane.updater": "false"}+ checks, err := svc.GetUpdateInfoByContainers(t.Context(), []container.Summary{{ID: "first", Image: "example:3.1.0", Labels: installExcluded}})+ require.NoError(t, err)+ require.Equal(t, firstTarget, checks["first"].LatestVersion)}diff --git a/backend/internal/imageupdate/image_update.go b/backend/internal/imageupdate/image_update.goindex 3dc0d72d6..a57a1043e 100644--- a/backend/internal/imageupdate/image_update.go+++ b/backend/internal/imageupdate/image_update.go@@ -29,7 +29,6 @@ import ("github.com/getarcaneapp/arcane/backend/v2/internal/event""github.com/getarcaneapp/arcane/backend/v2/internal/notification""github.com/getarcaneapp/arcane/backend/v2/internal/settings"- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/ratelimit""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/registryauth"@@ -45,7 +44,6 @@ import ("github.com/samber/mo""go.getarcane.app/sys/crypto""go.getarcane.app/updater/digest"- "go.getarcane.app/updater/labels""go.getarcane.app/updater/refs""golang.org/x/sync/errgroup""gorm.io/gorm"@@ -322,7 +320,8 @@ func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef striattachContainerUpdatesInternal(map[string]*imageupdate.Response{imageRef: result}, containerUpdates)s.completeImageUpdateActivityInternal(ctx, activityID, false, result.Error)if result.HasUpdate {- s.SendBatchUpdateNotifications(ctx)+ // A failed flush is already logged; the records stay pending for the next one.+ _ = s.SendBatchUpdateNotifications(ctx)return result, nil}return result, err@@ -352,7 +351,8 @@ func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef stris.notifyImageUpdateInternal(ctx, imageRef, digestResult, snapshot)attachContainerUpdatesInternal(map[string]*imageupdate.Response{imageRef: digestResult}, containerUpdates)if len(containerUpdates) > 0 {- s.SendBatchUpdateNotifications(ctx)+ // A failed flush is already logged; the records stay pending for the next one.+ _ = s.SendBatchUpdateNotifications(ctx)}finalMessage := "Image update check completed"@@ -735,16 +735,11 @@ func (s *ImageUpdateService) getAllImageRefsInternal(ctx context.Context, limitcontainerList, err := dockerClient.ContainerList(containerCtx, client.ContainerListOptions{All: true})cancelContainers()if err != nil {- slog.WarnContext(ctx, "failed to list Docker containers; continuing without updater opt-out filtering", "error", err.Error())+ slog.WarnContext(ctx, "failed to list Docker containers; continuing without update-check opt-out filtering", "error", err.Error())return imageRefsFromSummariesInternal(imageList.Items, limit), nil}- var excludedContainers map[string]bool- if s.settingsService != nil {- excludedContainers = dockerutil.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))- }-- return filterImageSummariesByContainerOptOutInternal(imageList.Items, containerList.Items, excludedContainers, limit), nil+ return filterImageSummariesByContainerOptOutInternal(imageList.Items, containerList.Items, limit), nil}func imageRefsFromSummariesInternal(images []image.Summary, limit int) []string {@@ -771,22 +766,52 @@ func imageRefsFromSummariesInternal(images []image.Summary, limit int) []stringreturn imageRefs}-func filterImageSummariesByContainerOptOutInternal(images []image.Summary, containers []container.Summary, excludedContainers map[string]bool, limit int) []string {+// monitoringEligibilityInternal records, per image ID and normalized+// reference, whether at least one consuming container still permits update+// checks. Only the update-check label is consulted: containers excluded from+// automatic installation keep being monitored.+type monitoringEligibilityInternal struct {// True when at least one container using the image ID or reference has// not opted out; present but false when every such container opted out.- eligibleByImageID := make(map[string]bool)- eligibleByRef := make(map[string]bool)+ byImageID map[string]bool+ byRef map[string]bool+ byContainer map[string]bool+}+func newMonitoringEligibilityInternal(containers []container.Summary) monitoringEligibilityInternal {+ eligibility := monitoringEligibilityInternal{byImageID: map[string]bool{}, byRef: map[string]bool{}, byContainer: map[string]bool{}}for _, summary := range containers {- eligible := !labels.IsUpdateDisabled(summary.Labels) && !dockerutil.ContainerNameExcluded(summary.Names, excludedContainers)-+ eligible := !imageref.IsUpdateCheckDisabled(summary.Labels)+ eligibility.byContainer[summary.ID] = eligibleif imageID := strings.TrimSpace(summary.ImageID); imageID != "" {- eligibleByImageID[imageID] = eligibleByImageID[imageID] || eligible+ eligibility.byImageID[imageID] = eligibility.byImageID[imageID] || eligible}if normalizedRef := refs.NormalizeImageUpdateRef(summary.Image); normalizedRef != "" {- eligibleByRef[normalizedRef] = eligibleByRef[normalizedRef] || eligible+ eligibility.byRef[normalizedRef] = eligibility.byRef[normalizedRef] || eligible}}+ return eligibility+}++// imageEligible reports whether an image may be checked: unused images are+// eligible, used images need one consumer that has not opted out.+func (e monitoringEligibilityInternal) imageEligible(imageID, normalizedRef string) bool {+ eligibleByID, usedByID := e.byImageID[strings.TrimSpace(imageID)]+ eligibleRef, usedByRef := e.byRef[normalizedRef]+ return (!usedByID && !usedByRef) || eligibleByID || eligibleRef+}++// recordEligible reports whether a stored result may still be reported. Results+// scoped to a container that no longer exists are stale and not eligible.+func (e monitoringEligibilityInternal) recordEligible(record *ImageUpdateRecord) bool {+ if record.ContainerID != "" {+ return e.byContainer[record.ContainerID]+ }+ return e.imageEligible(record.ID, refs.NormalizeImageUpdateRef(record.Repository+":"+record.Tag))+}++func filterImageSummariesByContainerOptOutInternal(images []image.Summary, containers []container.Summary, limit int) []string {+ eligibility := newMonitoringEligibilityInternal(containers)seen := make(map[string]struct{})filtered := make([]string, 0)@@ -803,9 +828,7 @@ func filterImageSummariesByContainerOptOutInternal(images []image.Summary, contareturn false}- eligibleByID, usedByID := eligibleByImageID[strings.TrimSpace(imageID)]- eligibleRef, usedByRef := eligibleByRef[key]- if (usedByID || usedByRef) && !eligibleByID && !eligibleRef {+ if !eligibility.imageEligible(imageID, key) {return false}@@ -1242,6 +1265,30 @@ func (s *ImageUpdateService) GetUnnotifiedUpdates(ctx context.Context) (map[strireturn result, nil}+// filterUnnotifiedByMonitoringInternal drops records whose resource no longer+// permits update checks, using the same eligibility rules as discovery. A+// failed container listing is returned so nothing is sent or marked.+func (s *ImageUpdateService) filterUnnotifiedByMonitoringInternal(ctx context.Context, records map[string]*ImageUpdateRecord) error {+ dockerClient, err := s.dockerClientInternal(ctx)+ if err != nil {+ return errors.WrapIf(err, "resolve update-check eligibility")+ }+ apiCtx, cancel := s.dockerAPIContextInternal(ctx)+ listed, err := dockerClient.ContainerList(apiCtx, client.ContainerListOptions{All: true})+ cancel()+ if err != nil {+ return errors.WrapIf(err, "list containers for update-check eligibility")+ }+ eligibility := newMonitoringEligibilityInternal(listed.Items)+ for id, record := range records {+ if !eligibility.recordEligible(record) {+ slog.DebugContext(ctx, "Skipping update notification for resource opted out of update checks", "recordId", id)+ delete(records, id)+ }+ }+ return nil+}+// MarkUpdatesAsNotified marks the given image IDs as having been notifiedfunc (s *ImageUpdateService) MarkUpdatesAsNotified(ctx context.Context, imageIDs []string) error {if len(imageIDs) == 0 {@@ -1645,14 +1692,19 @@ func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs"errorCount", errorCount,"duration", time.Since(startBatch))- s.SendBatchUpdateNotifications(ctx)+ // A failed flush is already logged; the records stay pending for the next one.+ _ = s.SendBatchUpdateNotifications(ctx)return results, nil}-func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) {+// SendBatchUpdateNotifications delivers pending update notifications. It+// returns an error only when the pending set could not be determined, so a+// caller about to consume the records can stop before their notifications+// are lost; delivery failures leave the records unnotified for the next flush.+func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) error {if s.notificationService == nil {- return+ return nil}// Serialize the query→send→mark sequence so the poll-end flush and the@@ -1675,9 +1727,16 @@ func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) {defer cancel()unnotifiedUpdates, err := s.GetUnnotifiedUpdates(notifCtx)+ if err == nil && len(unnotifiedUpdates) > 0 {+ // Records for resources that opted out of monitoring since the check, or+ // whose container is gone, stay unnotified: they resurface if monitoring+ // is re-enabled and are otherwise removed by orphan cleanup.+ err = s.filterUnnotifiedByMonitoringInternal(notifCtx, unnotifiedUpdates)+ }switch {case err != nil:slog.WarnContext(ctx, "Failed to get unnotified updates", "error", err.Error())+ return errors.WrapIf(err, "flush pending update notifications")case len(unnotifiedUpdates) > 0:updatesToNotify := make(map[string]*imageupdate.Response)imageIDsToMark := make([]string, 0, len(unnotifiedUpdates))@@ -1713,7 +1772,7 @@ func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) {// the next poll. Failures remain visible in the delivery history.if delivered == 0 {slog.DebugContext(ctx, "No providers delivered image update notifications; leaving records unnotified", "count", len(imageIDsToMark))- return+ return nil}if markErr := s.MarkUpdatesAsNotified(notifCtx, imageIDsToMark); markErr != nil {slog.WarnContext(ctx, "Failed to mark updates as notified", "error", markErr.Error())@@ -1721,6 +1780,7 @@ func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) {default:slog.DebugContext(ctx, "No new updates to notify")}+ return nil}func (s *ImageUpdateService) CheckAllImages(ctx context.Context, limit int, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error) {diff --git a/backend/internal/imageupdate/service_test.go b/backend/internal/imageupdate/service_test.goindex 5832194f8..e014971db 100644--- a/backend/internal/imageupdate/service_test.go+++ b/backend/internal/imageupdate/service_test.go@@ -1678,6 +1678,107 @@ func TestImageUpdateService_MarkUpdatesAsNotified_EmptyList(t *testing.T) {// regression where completeImageUpdateActivityInternal cancels the activity-tracked// ctx before the batch notification step runs, killing the unnotified-updates query// with "context canceled" so notifications were never dispatched (issue #2920).+// newImageUpdateNotificationDockerServiceInternal stubs the container listing+// the notification flush uses to resolve current update-check eligibility.+func newImageUpdateNotificationDockerServiceInternal(t *testing.T, containers []dockertypescontainer.Summary) *docker.DockerClientService {+ t.Helper()+ server := newImageUpdateDiscoveryServerInternal(t, nil, containers)+ t.Cleanup(server.Close)+ return &docker.DockerClientService{Client: newImageUpdateTestDockerClientInternal(t, server)}+}++func newImageUpdateGenericWebhookProviderInternal(t *testing.T, db *database.DB) *atomic.Int32 {+ t.Helper()+ var calls atomic.Int32+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {+ calls.Add(1)+ w.WriteHeader(http.StatusOK)+ }))+ t.Cleanup(server.Close)+ require.NoError(t, db.Create(¬ification.NotificationSettings{+ Provider: notifications.NotificationProviderGeneric,+ Enabled: true,+ Config: database.JSON{"webhookUrl": server.URL, "method": "POST", "contentType": "application/json"},+ }).Error)+ return &calls+}++// TestImageUpdateService_SendBatchNotifications_FiltersByUpdateCheckEligibility+// covers issue #3532: containers excluded from automatic installation keep+// receiving notifications, while the update-check label, stale container+// records, and images used only by opted-out containers are held back.+func TestImageUpdateService_SendBatchNotifications_FiltersByUpdateCheckEligibility(t *testing.T) {+ db := setupImageUpdateTestDB(t)+ require.NoError(t, db.AutoMigrate(¬ification.NotificationSettings{}))+ calls := newImageUpdateGenericWebhookProviderInternal(t, db)++ containers := []dockertypescontainer.Summary{+ {ID: "install-excluded", ImageID: "sha256:install-excluded", Image: "test/install-excluded:latest", Labels: map[string]string{labels.LabelUpdater: "false"}},+ {ID: "unmonitored", ImageID: "sha256:unmonitored", Image: "test/unmonitored:latest", Labels: map[string]string{imageref.UpdateCheckLabel: "false"}},+ {ID: "shared-unmonitored", ImageID: "sha256:shared", Image: "test/shared:latest", Labels: map[string]string{imageref.UpdateCheckLabel: "false"}},+ {ID: "shared-monitored", ImageID: "sha256:shared", Image: "test/shared:latest", Labels: map[string]string{labels.LabelUpdater: "false"}},+ {ID: "ref-only-unmonitored", ImageID: "sha256:rebuilt", Image: "test/ref-only:2.0", Labels: map[string]string{imageref.UpdateCheckLabel: "false"}},+ }+ notif := notification.NewNotificationService(db, nil, nil, nil, nil)+ svc := NewImageUpdateService(db, nil, nil, newImageUpdateNotificationDockerServiceInternal(t, containers), nil, notif, nil)++ records := []ImageUpdateRecord{+ {ID: "sha256:install-excluded", Repository: "docker.io/test/install-excluded", Tag: "latest", HasUpdate: true},+ {ID: "sha256:unmonitored", Repository: "docker.io/test/unmonitored", Tag: "latest", HasUpdate: true},+ {ID: "sha256:shared", Repository: "docker.io/test/shared", Tag: "latest", HasUpdate: true},+ {ID: "sha256:pruned", Repository: "docker.io/test/ref-only", Tag: "2.0", HasUpdate: true},+ {ID: "sha256:unused", Repository: "docker.io/test/unused", Tag: "latest", HasUpdate: true},+ {ID: "container::install-excluded", ContainerID: "install-excluded", ImageID: "sha256:install-excluded", Repository: "docker.io/test/install-excluded", Tag: "latest", HasUpdate: true, UpdateType: UpdateTypeTag},+ {ID: "container::unmonitored", ContainerID: "unmonitored", ImageID: "sha256:unmonitored", Repository: "docker.io/test/unmonitored", Tag: "latest", HasUpdate: true, UpdateType: UpdateTypeTag},+ {ID: "container::gone", ContainerID: "gone", ImageID: "sha256:gone", Repository: "docker.io/test/gone", Tag: "latest", HasUpdate: true, UpdateType: UpdateTypeTag},+ }+ require.NoError(t, db.Create(&records).Error)++ svc.SendBatchUpdateNotifications(context.Background())++ require.EqualValues(t, 1, calls.Load(), "eligible records are delivered in one batch")+ notified := map[string]bool{}+ var reloaded []ImageUpdateRecord+ require.NoError(t, db.Find(&reloaded).Error)+ for _, record := range reloaded {+ notified[record.ID] = record.NotificationSent+ }+ assert.True(t, notified["sha256:install-excluded"], "updater=false still notifies")+ assert.True(t, notified["sha256:shared"], "one monitored consumer keeps the image notified")+ assert.True(t, notified["sha256:unused"], "unused images stay monitored")+ assert.True(t, notified["container::install-excluded"], "check-only containers notify")+ assert.False(t, notified["sha256:unmonitored"], "image used only by an opted-out container")+ assert.False(t, notified["sha256:pruned"], "reference used only by an opted-out container")+ assert.False(t, notified["container::unmonitored"], "opted-out container record")+ assert.False(t, notified["container::gone"], "stale container record")++ // Re-enabling monitoring lets the held-back records notify on the next flush.+ containers[1].Labels = nil+ svc.dockerService = newImageUpdateNotificationDockerServiceInternal(t, containers)+ svc.SendBatchUpdateNotifications(context.Background())+ require.EqualValues(t, 2, calls.Load())+ var resumed ImageUpdateRecord+ require.NoError(t, db.First(&resumed, "id = ?", "container::unmonitored").Error)+ assert.True(t, resumed.NotificationSent)+}++func TestImageUpdateService_SendBatchNotifications_UnresolvedEligibilityLeavesUnnotified(t *testing.T) {+ db := setupImageUpdateTestDB(t)+ require.NoError(t, db.AutoMigrate(¬ification.NotificationSettings{}))+ calls := newImageUpdateGenericWebhookProviderInternal(t, db)++ notif := notification.NewNotificationService(db, nil, nil, nil, nil)+ svc := NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ require.NoError(t, db.Create(&ImageUpdateRecord{ID: "sha256:img", Repository: "test/repo", Tag: "latest", HasUpdate: true}).Error)++ svc.SendBatchUpdateNotifications(context.Background())++ require.Zero(t, calls.Load(), "nothing is sent when eligibility cannot be resolved")+ var reloaded ImageUpdateRecord+ require.NoError(t, db.First(&reloaded, "id = ?", "sha256:img").Error)+ assert.False(t, reloaded.NotificationSent)+}+func TestImageUpdateService_SendBatchNotifications_DetachesCanceledContext(t *testing.T) {db := setupImageUpdateTestDB(t)require.NoError(t, db.AutoMigrate(¬ification.NotificationSettings{}))@@ -1701,7 +1802,7 @@ func TestImageUpdateService_SendBatchNotifications_DetachesCanceledContext(t *te}).Error)notif := notification.NewNotificationService(db, nil, nil, nil, nil)- svc := NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ svc := NewImageUpdateService(db, nil, nil, newImageUpdateNotificationDockerServiceInternal(t, nil), nil, notif, nil)rec := ImageUpdateRecord{ID: "sha256:img1",@@ -1740,7 +1841,7 @@ func TestImageUpdateService_SendBatchNotifications_NoEligibleProviders_LeavesUnnrequire.NoError(t, db.AutoMigrate(¬ification.NotificationSettings{}))notif := notification.NewNotificationService(db, nil, nil, nil, nil)- svc := NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ svc := NewImageUpdateService(db, nil, nil, newImageUpdateNotificationDockerServiceInternal(t, nil), nil, notif, nil)rec := ImageUpdateRecord{ID: "sha256:img-no-provider",@@ -1792,7 +1893,7 @@ func TestImageUpdateService_SendBatchNotifications_PartialFailureStillMarksNotif}notif := notification.NewNotificationService(db, nil, nil, nil, nil)- svc := NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ svc := NewImageUpdateService(db, nil, nil, newImageUpdateNotificationDockerServiceInternal(t, nil), nil, notif, nil)rec := ImageUpdateRecord{ID: "sha256:img-partial",@@ -2017,7 +2118,7 @@ func TestImageUpdateService_GetAllImageRefsHonorsExclusiveContainerOptOutInterna{ID: "disabled-container",Image: disabledRef,- Labels: map[string]string{labels.LabelUpdater: "false"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "false"},},{ID: "enabled-container",@@ -2026,7 +2127,7 @@ func TestImageUpdateService_GetAllImageRefsHonorsExclusiveContainerOptOutInterna{ID: "shared-disabled-container",Image: sharedRef,- Labels: map[string]string{labels.LabelUpdater: "off"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "off"},},{ID: "shared-enabled-container",@@ -2034,7 +2135,7 @@ func TestImageUpdateService_GetAllImageRefsHonorsExclusiveContainerOptOutInterna},{ID: "running-only", ImageID: "sha256:untagged", Image: runningOnlyRef, State: dockertypescontainer.StateRunning},{ID: "stopped-only", ImageID: "sha256:pruned", Image: stoppedOnlyRef, State: dockertypescontainer.StateExited},- {ID: "disabled-only", ImageID: "sha256:pruned-disabled", Image: disabledOnlyRef, Labels: map[string]string{labels.LabelUpdater: "false"}},+ {ID: "disabled-only", ImageID: "sha256:pruned-disabled", Image: disabledOnlyRef, Labels: map[string]string{imageref.UpdateCheckLabel: "false"}},{ID: "enabled-alias", ImageID: "sha256:enabled", Image: enabledAlias},{ID: "pinned-container", ImageID: "sha256:pinned", Image: pinnedRef},{ID: "id-only", ImageID: idOnlyImage, Image: idOnlyImage},@@ -2076,7 +2177,7 @@ func TestImageUpdateService_GetAllImageRefsAppliesLimitAfterOptOutFilteringInter{ID: "disabled-container",Image: disabledRef,- Labels: map[string]string{labels.LabelUpdater: "0"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "0"},},{ID: "enabled-container",@@ -2130,7 +2231,7 @@ func TestImageUpdateService_GetAllImageRefsExcludesAliasesOfOptedOutImageInternaID: "disabled-container",ImageID: imageID,Image: primaryRef,- Labels: map[string]string{labels.LabelUpdater: "false"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "false"},},{ID: "enabled-container",@@ -2178,7 +2279,7 @@ func TestImageUpdateService_GetAllImageRefsKeepsImageSharedByEligibleContainerInID: "disabled-container",ImageID: imageID,Image: imageRef,- Labels: map[string]string{labels.LabelUpdater: "false"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "false"},},{ID: "enabled-container",@@ -2221,7 +2322,7 @@ func TestImageUpdateService_GetAllImageRefsFallsBackToRefWhenImageIDsDifferInterID: "disabled-container",ImageID: "sha256:container-list-id",Image: imageRef,- Labels: map[string]string{labels.LabelUpdater: "false"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "false"},},}@@ -2261,7 +2362,7 @@ func TestImageUpdateService_GetAllImageRefsMergesIDAndReferenceEligibilityInternID: "disabled-container",ImageID: imageID,Image: imageRef,- Labels: map[string]string{labels.LabelUpdater: "false"},+ Labels: map[string]string{imageref.UpdateCheckLabel: "false"},},{ID: "eligible-container",@@ -2329,29 +2430,34 @@ func TestImageUpdateService_GetAllImageRefsFallsBackWhenContainerDiscoveryFailsIassert.Equal(t, []string{firstRef, secondRef}, got)}-func TestFilterImageSummariesByContainerOptOutHonorsSettingsExclusionsInternal(t *testing.T) {+func TestFilterImageSummariesKeepsInstallExcludedContainersMonitoredInternal(t *testing.T) {const (- excludedRef = "local/excluded:latest"- sharedRef = "local/shared:latest"+ labelDisabledRef = "local/label-disabled:latest"+ uiExcludedRef = "local/ui-excluded:latest"+ unmonitoredRef = "local/unmonitored:latest"+ sharedRef = "local/shared:latest")images := []dockertypesimage.Summary{- {ID: "sha256:excluded", RepoTags: []string{excludedRef}},+ {ID: "sha256:label-disabled", RepoTags: []string{labelDisabledRef}},+ {ID: "sha256:ui-excluded", RepoTags: []string{uiExcludedRef}},+ {ID: "sha256:unmonitored", RepoTags: []string{unmonitoredRef}},{ID: "sha256:shared", RepoTags: []string{sharedRef}},}+ // Both automatic-installation exclusions keep the image monitored; only the+ // update-check label (any spelling, false-like values only) removes it.containers := []dockertypescontainer.Summary{- {ID: "c1", Names: []string{"/excluded-app"}, ImageID: "sha256:excluded", Image: excludedRef},- {ID: "c2", Names: []string{"/shared-excluded"}, ImageID: "sha256:shared", Image: sharedRef},- {ID: "c3", Names: []string{"/shared-enabled"}, ImageID: "sha256:shared", Image: sharedRef},- {ID: "c4", Names: []string{"/excluded-only"}, ImageID: "sha256:excluded-only", Image: "local/excluded-only:1.0"},- {ID: "c5", Names: []string{"/shared-short"}, ImageID: "sha256:shared", Image: "local/shared"},- {ID: "c6", Names: []string{"/shared-long"}, ImageID: "sha256:shared", Image: "docker.io/local/shared:latest"},+ {ID: "c1", Names: []string{"/label-disabled"}, ImageID: "sha256:label-disabled", Image: labelDisabledRef, Labels: map[string]string{labels.LabelUpdater: "false"}},+ {ID: "c2", Names: []string{"/ui-excluded"}, ImageID: "sha256:ui-excluded", Image: uiExcludedRef},+ {ID: "c3", Names: []string{"/unmonitored"}, ImageID: "sha256:unmonitored", Image: unmonitoredRef, Labels: map[string]string{strings.ToUpper(imageref.UpdateCheckLabel): "no"}},+ {ID: "c4", Names: []string{"/shared-unmonitored"}, ImageID: "sha256:shared", Image: sharedRef, Labels: map[string]string{imageref.UpdateCheckLabel: "off"}},+ {ID: "c5", Names: []string{"/shared-garbage-value"}, ImageID: "sha256:shared", Image: "docker.io/local/shared:latest", Labels: map[string]string{imageref.UpdateCheckLabel: "maybe", labels.LabelUpdater: "false"}},+ {ID: "c6", Names: []string{"/unmonitored-only"}, ImageID: "sha256:pruned", Image: "local/unmonitored-only:1.0", Labels: map[string]string{imageref.UpdateCheckLabel: "0"}},}- excluded := map[string]bool{"excluded-app": true, "shared-excluded": true, "excluded-only": true, "unknown-name": true}- got := filterImageSummariesByContainerOptOutInternal(images, containers, excluded, 0)+ got := filterImageSummariesByContainerOptOutInternal(images, containers, 0)- assert.Equal(t, []string{sharedRef}, got)+ assert.Equal(t, []string{labelDisabledRef, uiExcludedRef, sharedRef}, got)}// testProjectRow is a minimal stand-in for project.Project: the project@@ -2462,6 +2568,77 @@ func TestContainerTagChecksPersistIndependentPoliciesInternal(t *testing.T) {}+// TestContainerTagChecksSeparateMonitoringFromInstallationInternal covers+// issue #3532: a container excluded from automatic installation still gets a+// tag check, while the update-check label skips the check and leaves the+// container's stored result untouched for the installer.+func TestContainerTagChecksSeparateMonitoringFromInstallationInternal(t *testing.T) {+ db := setupImageUpdateRegistryTestDBInternal(t)+ registryServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if !strings.HasSuffix(r.URL.Path, "/tags/list") {+ http.NotFound(w, r)+ return+ }+ w.Header().Set("Content-Type", "application/json")+ require.NoError(t, json.NewEncoder(w).Encode(map[string]any{"name": "team/app", "tags": []string{"1.0.0", "1.1.0"}}))+ }))+ defer registryServer.Close()+ registryURL, err := url.Parse(registryServer.URL)+ require.NoError(t, err)+ imageRef := registryURL.Host + "/team/app:1.0.0"+ imageID := digest.FromString("shared").String()+ values := map[string]map[string]string{+ "install-excluded": {labels.LabelUpdateStrategy: "auto", labels.LabelUpdater: "false"},+ "unmonitored": {labels.LabelUpdateStrategy: "auto", imageref.UpdateCheckLabel: "false"},+ }+ var inspected []string+ dockerServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ w.Header().Set("Content-Type", "application/json")+ switch {+ case strings.HasSuffix(r.URL.Path, "/containers/json"):+ require.NoError(t, json.NewEncoder(w).Encode([]dockertypescontainer.Summary{+ {ID: "install-excluded", Names: []string{"/install-excluded"}, Image: imageRef, ImageID: imageID, Labels: values["install-excluded"]},+ {ID: "unmonitored", Names: []string{"/unmonitored"}, Image: imageRef, ImageID: imageID, Labels: values["unmonitored"]},+ }))+ case strings.Contains(r.URL.Path, "/containers/"):+ id := "install-excluded"+ if strings.Contains(r.URL.Path, "/unmonitored/") {+ id = "unmonitored"+ }+ inspected = append(inspected, id)+ require.NoError(t, json.NewEncoder(w).Encode(dockertypescontainer.InspectResponse{ID: id, Name: "/" + id, Image: imageID, Config: &dockertypescontainer.Config{Image: imageRef, Labels: values[id]}}))+ default:+ t.Errorf("unexpected Docker request %s", r.URL.Path)+ http.NotFound(w, r)+ }+ }))+ defer dockerServer.Close()+ registryService := registry.NewContainerRegistryService(db, func(context.Context) (registry.RegistryDaemonClient, error) {+ return &fakeRegistryDaemonClient{}, nil+ }, nil, registryServer.Client())+ settingsService := newImageUpdateTestSettingsServiceInternal(t, "5", "5")+ // The UI exclusion governs installation only; it must not reach the checker.+ require.NoError(t, settingsService.SetStringSetting(t.Context(), "autoUpdateExcludedContainers", "install-excluded"))+ svc := NewImageUpdateService(db, settingsService, registryService, &docker.DockerClientService{Client: newImageUpdateTestDockerClientInternal(t, dockerServer)}, nil, nil, nil)++ pending := "1.1.0"+ stale := ImageUpdateRecord{ID: "container::unmonitored", ContainerID: "unmonitored", ImageID: imageID, PolicyKey: imageref.UpdatePolicyKey(imageRef, values["unmonitored"]), Repository: registryURL.Host + "/team/app", Tag: "1.0.0", HasUpdate: true, UpdateType: UpdateTypeTag, LatestVersion: &pending, CheckTime: time.Now().UTC()}+ require.NoError(t, db.Create(&stale).Error)++ checks, err := svc.checkContainerTagUpdatesInternal(t.Context(), []string{imageRef}, nil)+ require.NoError(t, err)+ require.Len(t, checks, 1)+ require.True(t, checks["install-excluded"].HasUpdate, "updater=false and the UI exclusion do not block checks")+ require.Equal(t, "1.1.0", checks["install-excluded"].LatestVersion)+ require.Empty(t, checks["install-excluded"].Error)+ require.Equal(t, []string{"install-excluded"}, inspected, "opted-out containers are never inspected")++ var retained ImageUpdateRecord+ require.NoError(t, db.First(&retained, "id = ?", "container::unmonitored").Error)+ require.True(t, retained.HasUpdate, "monitoring opt-out keeps pending updates for the installer")+ require.Equal(t, stale.PolicyKey, retained.PolicyKey)+}+func TestContainerAggregationPreservesImageResultInternal(t *testing.T) {original := &imageupdate.Response{HasUpdate: false, UpdateType: UpdateTypeDigest, CurrentVersion: "3.20.0", LatestVersion: "3.20.0"}results := map[string]*imageupdate.Response{"alpine:3.20.0": original}diff --git a/backend/internal/imageupdate/tag_updates.go b/backend/internal/imageupdate/tag_updates.goindex eabc317bc..fe0c99a34 100644--- a/backend/internal/imageupdate/tag_updates.go+++ b/backend/internal/imageupdate/tag_updates.go@@ -5,7 +5,6 @@ import ("fmt""log/slog""slices"- "strings""sync""time"@@ -170,8 +169,12 @@ func (s *ImageUpdateService) checkContainerTagUpdatesInternal(ctx context.Contexreturn results, errors.WrapIf(err, "list containers for tag update checks")}+ // This engine only reads. Containers excluded from automatic installation+ // (updater label or UI exclusion) are still checked; only the update-check+ // label opts a container out of monitoring, so no Settings provider is wired.adapter := newTagRegistryInternal(s.registryService, credentials, s.dockerService, s.settingsService)- engine, err := updater.New(updater.Config{RegistryTagLister: adapter, RegistryDigestResolver: adapter, DockerClientProvider: adapter, Settings: adapter})+ checkPolicy := updater.LabelPolicy{IsUpdateDisabledFunc: imageref.IsUpdateCheckDisabled}+ engine, err := updater.New(updater.Config{RegistryTagLister: adapter, RegistryDigestResolver: adapter, DockerClientProvider: adapter, LabelPolicy: checkPolicy})if err != nil {return results, err}@@ -184,7 +187,7 @@ func (s *ImageUpdateService) checkContainerTagUpdatesInternal(ctx context.Contexcandidates := make([]container.Summary, 0, len(listed.Items))var staleDigestContainerIDs []stringfor _, cnt := range listed.Items {- if !wanted[refs.NormalizeImageUpdateRef(cnt.Image)] {+ if !wanted[refs.NormalizeImageUpdateRef(cnt.Image)] || imageref.IsUpdateCheckDisabled(cnt.Labels) {continue}tagPolicy, policyErr := tagpolicy.Resolve(cnt.Image, policy.TagPolicy(cnt.Labels))@@ -295,13 +298,6 @@ func (r tagRegistryInternal) DockerClient(ctx context.Context) (*client.Client,return r.docker.GetClient(ctx)}-func (r tagRegistryInternal) ExcludedContainers(ctx context.Context) ([]string, error) {- if r.settings == nil {- return nil, nil- }- return strings.Split(r.settings.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""), ","), nil-}-func (s *ImageUpdateService) saveContainerTagResultInternal(ctx context.Context, cnt container.Summary, result *imageupdatetypes.Response) error {if s.db == nil {return nildiff --git a/backend/internal/project/project_details.go b/backend/internal/project/project_details.goindex 628424371..6db6e9350 100644--- a/backend/internal/project/project_details.go+++ b/backend/internal/project/project_details.go@@ -646,7 +646,7 @@ func BuildConfiguredUpdateInfo(projectID string, services []composetypes.Servicepolicy, policyErr := tagpolicy.Resolve(imageRef, updater.DefaultLabelPolicy().TagPolicy(service.Labels))if record != nil && record.PolicyKey == imageref.UpdatePolicyKey(imageRef, service.Labels) {info = record.UpdateInfo()- } else if policyErr == nil && policy.Strategy == "digest" {+ } else if policyErr == nil && policy.Strategy == "digest" && !imageref.IsUpdateCheckDisabled(service.Labels) {info = byRef[imageRef]}@@ -724,6 +724,21 @@ func (s *ProjectService) getProjectContainerUpdateInfoInternal(ctx context.Contefunc mergeProjectContainerUpdateInfoInternal(base map[string]*imagetypes.UpdateInfo, services []project.RuntimeService, scoped map[string]*imagetypes.UpdateInfo) map[string]*imagetypes.UpdateInfo {result := make(map[string]*imagetypes.UpdateInfo, len(base))maps.Copy(result, base)+ // Shared image results are dropped for references used only by services+ // that opted out of update checks.+ monitored := make(map[string]bool)+ for _, service := range services {+ imageRef := strings.TrimSpace(service.Image)+ if imageRef == "" {+ continue+ }+ monitored[imageRef] = monitored[imageRef] || !imageref.IsUpdateCheckDisabled(service.ContainerLabels)+ }+ for imageRef, isMonitored := range monitored {+ if !isMonitored {+ delete(result, imageRef)+ }+ }seen := make(map[string]bool)for _, service := range services {info := scoped[service.ContainerID]diff --git a/backend/internal/project/service_test.go b/backend/internal/project/service_test.goindex f904d88dd..a5795a3e2 100644--- a/backend/internal/project/service_test.go+++ b/backend/internal/project/service_test.go@@ -7487,7 +7487,11 @@ func TestDiscoveredProjectTagUpdatesRemainScoped(t *testing.T) {detail.RuntimeServices[0].ContainerLabels = containers[1].Labelsservice.enrichProjectUpdateInfoInternal(t.Context(), &detail)require.False(t, detail.UpdateInfo.HasUpdate, "an undeclared strategy no longer inherits a tag record")- for _, policy := range []map[string]string{{labels.LabelUpdateStrategy: "digest"}, {labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "3.1.x"}, {labels.LabelUpdateStrategy: "tag", labels.LabelUpdateTagPattern: ".*"}, {labels.LabelUpdateStrategy: "tag", labels.LabelUpdater: "off"}} {+ // Turning off automatic installation keeps the check current (#3532).+ containers[1].Labels = map[string]string{labels.LabelUpdateStrategy: "tag", labels.LabelUpdater: "off", "com.docker.compose.project": "first-project", "com.docker.compose.service": "web"}+ rows = buildDiscoveredComposeProjectUpdateRowsInternal(t.Context(), containers, nil, imageSvc, "")+ require.Len(t, rows, 1, "updater=false containers keep their check results")+ for _, policy := range []map[string]string{{labels.LabelUpdateStrategy: "digest"}, {labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "3.1.x"}, {labels.LabelUpdateStrategy: "tag", labels.LabelUpdateTagPattern: ".*"}, {labels.LabelUpdateStrategy: "tag", imageref.UpdateCheckLabel: "off"}} {current := map[string]string{"com.docker.compose.project": "first-project", "com.docker.compose.service": "web"}for key, value := range policy {current[key] = value@@ -7513,6 +7517,17 @@ func TestProjectTagSummaryDoesNotMutateSharedReferenceResults(t *testing.T) {require.Empty(t, merged["example:3.1.0"].LatestVersion)require.False(t, base["example:3.1.0"].HasUpdate)require.Equal(t, "3.2.0", scoped["first"].LatestVersion)++ // A shared image result is dropped when every service using the reference+ // opted out of update checks, and kept while one still monitors it.+ base = map[string]*imagetypes.UpdateInfo{"example:3.1.0": {HasUpdate: true, UpdateType: "digest"}, "other:1.0": {HasUpdate: true, UpdateType: "digest"}}+ unmonitored := map[string]string{imageref.UpdateCheckLabel: "false"}+ merged = mergeProjectContainerUpdateInfoInternal(base, []projecttypes.RuntimeService{{ContainerID: "a", Image: "example:3.1.0", ContainerLabels: unmonitored}, {ContainerID: "b", Image: "example:3.1.0", ContainerLabels: map[string]string{labels.LabelUpdater: "false"}}}, nil)+ require.True(t, merged["example:3.1.0"].HasUpdate, "updater=false keeps the shared result")+ require.True(t, merged["other:1.0"].HasUpdate, "references without runtime services are untouched")+ merged = mergeProjectContainerUpdateInfoInternal(base, []projecttypes.RuntimeService{{ContainerID: "a", Image: "example:3.1.0", ContainerLabels: unmonitored}}, nil)+ require.NotContains(t, merged, "example:3.1.0")+ require.True(t, base["example:3.1.0"].HasUpdate)}func TestCountProjectsWithPendingTagUpdatesUsesRuntimeContainers(t *testing.T) {diff --git a/backend/internal/updater/service.go b/backend/internal/updater/service.goindex d96586ac6..aa58c3548 100644--- a/backend/internal/updater/service.go+++ b/backend/internal/updater/service.go@@ -693,9 +693,12 @@ func (s *UpdaterService) PendingImageUpdates(ctx context.Context) ([]updater.Ima// Flush pending "Updates Available" notifications before the engine// consumes and clears these records, otherwise the notification for an- // update applied here is silently lost (#3132).+ // update applied here is silently lost (#3132). A flush that cannot+ // determine what to send aborts the run so the records survive for retry.if s.deps.ImageUpdates != nil {- s.deps.ImageUpdates.SendBatchUpdateNotifications(ctx)+ if err := s.deps.ImageUpdates.SendBatchUpdateNotifications(ctx); err != nil {+ return nil, err+ }}s.appendAutoUpdateActivityMessageInternal(ctx,diff --git a/backend/internal/updater/service_test.go b/backend/internal/updater/service_test.goindex 7d434b529..7b97a58d2 100644--- a/backend/internal/updater/service_test.go+++ b/backend/internal/updater/service_test.go@@ -567,6 +567,43 @@ func TestUpdaterService_PendingImageUpdatesAdapterInternal(t *testing.T) {}// TestUpdaterService_PendingImageUpdatesFlushesPendingNotificationsInternal guards+// newEmptyContainerListDockerServiceInternal stubs the container listing the+// notification flush uses to resolve update-check eligibility.+func newEmptyContainerListDockerServiceInternal(t *testing.T) *docker.DockerClientService {+ t.Helper()+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ w.Header().Set("Content-Type", "application/json")+ if strings.HasSuffix(r.URL.Path, "/containers/json") {+ require.NoError(t, json.NewEncoder(w).Encode([]container.Summary{}))+ return+ }+ http.NotFound(w, r)+ }))+ t.Cleanup(server.Close)+ return &docker.DockerClientService{Client: newTestDockerClientInternal(t, server)}+}++// PendingImageUpdates must not hand records to the engine when the flush could+// not determine what to send (#3532): consuming them would lose the pending+// notification for good instead of retrying once Docker is reachable again.+func TestUpdaterService_PendingImageUpdatesAbortsWhenNotificationEligibilityUnresolvedInternal(t *testing.T) {+ db := setupProjectTestDBInternal(t)+ require.NoError(t, db.AutoMigrate(&imageupdate.ImageUpdateRecord{}, ¬ification.NotificationSettings{}))+ notif := notification.NewNotificationService(db, nil, nil, nil, nil)+ imageUpdates := imageupdate.NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ svc, err := NewUpdaterService(db, nil, nil, nil, imageUpdates, nil, nil, nil, notif, nil, nil)+ require.NoError(t, err)+ require.NoError(t, db.Create(&imageupdate.ImageUpdateRecord{ID: "sha256:pending", Repository: "test/repo", Tag: "latest", HasUpdate: true}).Error)++ records, err := svc.PendingImageUpdates(context.Background())+ require.ErrorContains(t, err, "flush pending update notifications")+ require.Nil(t, records)+ var reloaded imageupdate.ImageUpdateRecord+ require.NoError(t, db.First(&reloaded, "id = ?", "sha256:pending").Error)+ require.True(t, reloaded.HasUpdate)+ require.False(t, reloaded.NotificationSent)+}+// issue #3132: the updater consumes and clears has_update records without checking// notification_sent, so an "Updates Available" notification pending at consumption// time was silently lost. PendingImageUpdates must flush it before the engine runs.@@ -592,7 +629,7 @@ func TestUpdaterService_PendingImageUpdatesFlushesPendingNotificationsInternal(t}).Error)notif := notification.NewNotificationService(db, nil, nil, nil, nil)- imageUpdates := imageupdate.NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ imageUpdates := imageupdate.NewImageUpdateService(db, nil, nil, newEmptyContainerListDockerServiceInternal(t), nil, notif, nil)svc, svcErr := NewUpdaterService(db, nil, nil, nil, imageUpdates, nil, nil, nil, notif, nil, nil)require.NoError(t, svcErr)@@ -623,7 +660,7 @@ func TestUpdaterService_PendingImageUpdatesNoProvidersLeavesUnnotifiedInternal(trequire.NoError(t, db.AutoMigrate(&imageupdate.ImageUpdateRecord{}, ¬ification.NotificationSettings{}))notif := notification.NewNotificationService(db, nil, nil, nil, nil)- imageUpdates := imageupdate.NewImageUpdateService(db, nil, nil, nil, nil, notif, nil)+ imageUpdates := imageupdate.NewImageUpdateService(db, nil, nil, newEmptyContainerListDockerServiceInternal(t), nil, notif, nil)svc, svcErr := NewUpdaterService(db, nil, nil, nil, imageUpdates, nil, nil, nil, notif, nil, nil)require.NoError(t, svcErr)diff --git a/backend/internal/updater/tag_updates.go b/backend/internal/updater/tag_updates.goindex 3de675be4..18ecc0fa5 100644--- a/backend/internal/updater/tag_updates.go+++ b/backend/internal/updater/tag_updates.go@@ -162,11 +162,12 @@ func (s *UpdaterService) checkProjectServiceInternal(ctx context.Context, projecrecord.UpdateType = imageupdate.UpdateTypeLocalreturn record}- policy := updater.DefaultLabelPolicy()- if policy.IsUpdateDisabled(service.Labels) {+ // Disabling automatic installation keeps the preview check; only the+ // update-check label opts a service out of monitoring.+ if imageref.IsUpdateCheckDisabled(service.Labels) {return record}- check, err := s.engine.CheckImageUpdate(ctx, updatertypes.CheckRequest{ImageRef: service.Image, Policy: policy.TagPolicy(service.Labels)})+ check, err := s.engine.CheckImageUpdate(ctx, updatertypes.CheckRequest{ImageRef: service.Image, Policy: updater.DefaultLabelPolicy().TagPolicy(service.Labels)})if err != nil {if cerrdefs.IsNotFound(err) {record.UpdateType = imageupdate.UpdateTypeNotPulleddiff --git a/backend/pkg/utils/imageref/update_lookup.go b/backend/pkg/utils/imageref/update_lookup.goindex 5b07705f2..b981a0f07 100644--- a/backend/pkg/utils/imageref/update_lookup.go+++ b/backend/pkg/utils/imageref/update_lookup.go@@ -11,8 +11,35 @@ import (ref "github.com/distribution/reference""github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/registryauth"+ "github.com/getarcaneapp/arcane/backend/v2/pkg/utils")+// UpdateCheckLabel opts a container or service out of update checks and+// notifications. Automatic installation is governed separately by the+// updater label and the UI exclusion list.+const UpdateCheckLabel = "com.getarcaneapp.arcane.update-check"++// IsUpdateCheckDisabled reports whether labels opt the resource out of update+// monitoring. Checks stay enabled unless the value parses as false.+func IsUpdateCheckDisabled(labels map[string]string) bool {+ value, ok := labels[UpdateCheckLabel]+ if !ok {+ // Other spellings are accepted; among conflicting ones the smallest key+ // wins so the answer does not depend on map iteration order.+ var matched string+ for key, candidate := range labels {+ if strings.EqualFold(strings.TrimSpace(key), UpdateCheckLabel) && (!ok || key < matched) {+ matched, value, ok = key, candidate, true+ }+ }+ }+ if !ok {+ return false+ }+ enabled, parsed := utils.ParseBool(value)+ return parsed && !enabled+}+// LocalBuildRegistry is Arcane's reserved registry host for locally built image tags.const LocalBuildRegistry = "arcane.local"@@ -60,11 +87,13 @@ func ParseUpdateLookup(imageRef string) (originalRef, tag string, repositoryCandreturn trimmedRef, tag, repositoryCandidates, true}-// UpdatePolicyKey identifies the configured reference and selection policy.+// UpdatePolicyKey identifies the configured reference, selection policy, and+// monitoring eligibility a stored check result belongs to. Automatic+// installation eligibility is deliberately not part of the key.func UpdatePolicyKey(imageRef string, labels map[string]string) string {policy := updater.DefaultLabelPolicy().TagPolicy(labels)if resolved, err := tagpolicy.Resolve(imageRef, policy); err == nil {policy = resolved}- return fmt.Sprintf("%q:%q:%q:%q:%t", refs.NormalizeImageUpdateRef(imageRef), policy.Strategy, policy.Constraint, policy.TagPattern, updater.DefaultLabelPolicy().IsUpdateDisabled(labels))+ return fmt.Sprintf("%q:%q:%q:%q:%t", refs.NormalizeImageUpdateRef(imageRef), policy.Strategy, policy.Constraint, policy.TagPattern, IsUpdateCheckDisabled(labels))}diff --git a/backend/pkg/utils/imageref/update_lookup_test.go b/backend/pkg/utils/imageref/update_lookup_test.gonew file mode 100644index 000000000..4088289c9--- /dev/null+++ b/backend/pkg/utils/imageref/update_lookup_test.go@@ -0,0 +1,30 @@+package imageref++import (+ "testing"++ "github.com/stretchr/testify/require"+ "go.getarcane.app/updater/labels"+)++func TestIsUpdateCheckDisabled(t *testing.T) {+ for value, want := range map[string]bool{"false": true, "0": true, "no": true, " OFF ": true, "true": false, "yes": false, "": false, "maybe": false} {+ require.Equal(t, want, IsUpdateCheckDisabled(map[string]string{UpdateCheckLabel: value}), "value %q", value)+ }+ require.True(t, IsUpdateCheckDisabled(map[string]string{"COM.GETARCANEAPP.ARCANE.UPDATE-CHECK": "false"}), "label names match case-insensitively")+ for range 50 {+ require.False(t, IsUpdateCheckDisabled(map[string]string{UpdateCheckLabel: "true", "COM.GETARCANEAPP.ARCANE.UPDATE-CHECK": "false", "Com.GetArcaneApp.Arcane.Update-Check": "false"}), "the canonical key wins over other spellings")+ require.True(t, IsUpdateCheckDisabled(map[string]string{"COM.GETARCANEAPP.ARCANE.UPDATE-CHECK": "false", "com.getarcaneapp.arcane.Update-Check": "true"}), "conflicting spellings resolve deterministically")+ }+ require.False(t, IsUpdateCheckDisabled(nil))+ require.False(t, IsUpdateCheckDisabled(map[string]string{labels.LabelUpdater: "false"}), "the updater label only governs installation")+}++func TestUpdatePolicyKeyTracksMonitoringNotInstallation(t *testing.T) {+ base := map[string]string{labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "3.x"}+ installExcluded := map[string]string{labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "3.x", labels.LabelUpdater: "false"}+ unmonitored := map[string]string{labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "3.x", UpdateCheckLabel: "false"}+ require.Equal(t, UpdatePolicyKey("example:3.1.0", base), UpdatePolicyKey("example:3.1.0", installExcluded), "changing installation eligibility keeps results current")+ require.NotEqual(t, UpdatePolicyKey("example:3.1.0", base), UpdatePolicyKey("example:3.1.0", unmonitored), "changing monitoring eligibility invalidates results")+ require.NotEqual(t, UpdatePolicyKey("example:3.1.0", base), UpdatePolicyKey("example:3.1.0", map[string]string{labels.LabelUpdateStrategy: "tag", labels.LabelUpdateConstraint: "4.x"}))+}diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 569417926..87b2bdbe9 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -277,7 +277,9 @@"prune_duration_help": "Duration values are stored using Docker-compatible time filters such as 30m, 24h, or 168h.","prune_duration_placeholder": "24","prune_images_dialog_description": "Choose how aggressively Arcane should prune unused Docker images.",- "auto_update_exclude_description": "Select containers to exclude from automatic updates.",+ "auto_update_exclude_description": "Select containers that should not be updated automatically. Arcane keeps checking them for updates and sending notifications.",+ "auto_update_check_label_hint": "To stop update checks and notifications for a container, add the label {label} to it.",+ "auto_update_disabled_checks_continue": "Update checks and notifications stay enabled; only automatic installation is turned off.","auto_update_title": "Auto-Update","auto_update_enabled_toast": "Auto-update enabled","auto_update_disabled_toast": "Auto-update disabled",@@ -863,7 +865,10 @@"updates_bulk_update_success": "Updated {count} resource(s)","updates_bulk_update_partial": "Updated {success} of {total} resource(s), {failed} failed","updates_bulk_update_failed": "Failed to update the selected resources",- "updates_ignore_description": "Exclude this container from automatic updates",+ "updates_disable_auto_update": "Disable automatic updates",+ "updates_enable_auto_update": "Enable automatic updates",+ "updates_auto_update_disabled": "Automatic updates disabled",+ "updates_disable_auto_update_description": "Stop installing updates for this container automatically. Update checks and notifications stay enabled.","updates_update_confirm_message": "This pulls the latest images and applies the pending updates for \"{name}\". Do you want to continue?","tag": "Tag","images_tag_image": "Tag Image",diff --git a/frontend/src/lib/utils/container-auto-update.ts b/frontend/src/lib/utils/container-auto-update.tsindex 70e880771..94856f432 100644--- a/frontend/src/lib/utils/container-auto-update.ts+++ b/frontend/src/lib/utils/container-auto-update.ts@@ -3,10 +3,14 @@* container detail page and the updates table. The backend stores exclusions* as a CSV of container *names* in `autoUpdateExcludedContainers`, and the* Docker label `com.getarcaneapp.arcane.updater=false` overrides that setting.- * Container responses carry the resolved `autoUpdateEnabled` status.+ * Container responses carry the resolved `autoUpdateEnabled` status. Both+ * controls only stop automatic installation; update checks and notifications+ * are opted out separately with `UPDATE_CHECK_LABEL`.*/const AUTO_UPDATE_LABEL = 'com.getarcaneapp.arcane.updater';+/** Setting this label to a false-like value disables update checks and notifications. */+export const UPDATE_CHECK_LABEL = 'com.getarcaneapp.arcane.update-check';const DISABLED_LABEL_VALUES = ['false', '0', 'no', 'off'];/** Strips the leading slashes Docker puts on container names. */diff --git a/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte b/frontend/src/routes/(app)/containers/components/ContainerOverview.svelteindex 62b82aa66..39147ce96 100644--- a/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte+++ b/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte@@ -182,8 +182,13 @@</div>{#if !autoUpdateStatusAvailable}<span class="text-xs text-muted-foreground">{m.auto_update_status_unavailable()}</span>- {:else if autoUpdateLabelControlled}- <span class="text-xs text-muted-foreground">{m.auto_update_controlled_by_label()}</span>+ {:else}+ {#if autoUpdateLabelControlled}+ <span class="text-xs text-muted-foreground">{m.auto_update_controlled_by_label()}</span>+ {/if}+ {#if !autoUpdateEnabled}+ <span class="text-xs text-muted-foreground">{m.auto_update_disabled_checks_continue()}</span>+ {/if}{/if}</KeyValueCard>diff --git a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelteindex 57388e994..b6d39c972 100644--- a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte+++ b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte@@ -21,6 +21,7 @@import type { ContainerSummaryDto } from '#lib/types/docker.js';import type { JobsTabProps } from './tab-props';import {+ UPDATE_CHECK_LABEL,isAutoUpdateLabelDisabled,normalizeContainerName,parseExcludedContainerSet@@ -213,6 +214,9 @@{/await}</Label><p class="text-xs text-muted-foreground">{m.auto_update_exclude_description()}</p>+ <p class="text-xs text-muted-foreground">+ {m.auto_update_check_label_hint({ label: `${UPDATE_CHECK_LABEL}=false` })}+ </p></div><div class="space-y-2">diff --git a/frontend/src/routes/(app)/updates/+page.svelte b/frontend/src/routes/(app)/updates/+page.svelteindex 7201acbcb..f94d79b50 100644--- a/frontend/src/routes/(app)/updates/+page.svelte+++ b/frontend/src/routes/(app)/updates/+page.svelte@@ -225,7 +225,7 @@<ContainerUpdatesTable{containers}bind:requestOptions={containerRequestOptions}- onIgnoreChanged={invalidateContainerQueries}+ onAutoUpdateChanged={invalidateContainerQueries}onRefreshData={async (options) => {const requestedEnvId = envId;const requestedOptions = ensureStandaloneContainerUpdatesFilter(options);diff --git a/frontend/src/routes/(app)/updates/container-updates-table.svelte b/frontend/src/routes/(app)/updates/container-updates-table.svelteindex d41f353d6..b1af83dbc 100644--- a/frontend/src/routes/(app)/updates/container-updates-table.svelte+++ b/frontend/src/routes/(app)/updates/container-updates-table.svelte@@ -43,11 +43,12 @@currentValue: string;latestValue: string;checkedAt: string;- ignored: boolean;+ /** Automatic installation is off; checks and notifications still run. */+ autoUpdateDisabled: boolean;labelControlled: boolean;- /** False when the agent omitted `autoUpdateEnabled`; ignoring is then unavailable. */+ /** False when the agent omitted `autoUpdateEnabled`; toggling is then unavailable. */statusAvailable: boolean;- ignoreTitle: string;+ autoUpdateTitle: string;updateInfo?: ImageUpdateInfoDto;container: ContainerSummaryDto;};@@ -56,15 +57,15 @@containers: ContainersPaginatedResponse;requestOptions: SearchPaginationSortRequest;onRefreshData: (options: ContainerListRequestOptions) => Promise<ContainersPaginatedResponse>;- onIgnoreChanged?: () => Promise<unknown> | unknown;+ onAutoUpdateChanged?: () => Promise<unknown> | unknown;}- let { containers = $bindable(), requestOptions = $bindable(), onRefreshData, onIgnoreChanged }: Props = $props();+ let { containers = $bindable(), requestOptions = $bindable(), onRefreshData, onAutoUpdateChanged }: Props = $props();let selectedIds = $state<string[]>([]);let mobileFieldVisibility = $state<MobileFieldVisibility>({});let updatingContainerIds = $state<Record<string, boolean>>({});- let ignoringContainerIds = $state<Record<string, boolean>>({});+ let togglingAutoUpdateIds = $state<Record<string, boolean>>({});let bulkUpdating = $state(false);let updateTableMounted = false;const currentEnvironmentId = $derived(environmentStore.selected?.id || '0');@@ -87,11 +88,14 @@const name = getContainerDisplayName(container);const labelControlled = isAutoUpdateLabelDisabled(container.labels);const statusAvailable = typeof container.autoUpdateEnabled === 'boolean';- let ignoreTitle = m.updates_ignore_description();+ const autoUpdateDisabled = container.autoUpdateEnabled === false;+ let autoUpdateTitle = m.updates_disable_auto_update_description();if (!statusAvailable) {- ignoreTitle = m.auto_update_status_unavailable();+ autoUpdateTitle = m.auto_update_status_unavailable();} else if (labelControlled) {- ignoreTitle = m.auto_update_controlled_by_label();+ autoUpdateTitle = m.auto_update_controlled_by_label();+ } else if (autoUpdateDisabled) {+ autoUpdateTitle = m.auto_update_disabled_checks_continue();}return {id: container.id,@@ -101,10 +105,10 @@currentValue: formatImageUpdateValue(container.updateInfo, 'current'),latestValue: formatImageUpdateValue(container.updateInfo, 'latest'),checkedAt: container.updateInfo?.checkTime ?? '',- ignored: container.autoUpdateEnabled === false,+ autoUpdateDisabled,labelControlled,statusAvailable,- ignoreTitle,+ autoUpdateTitle,updateInfo: container.updateInfo,container};@@ -153,12 +157,13 @@});}- // Ignoring writes to the shared `autoUpdateExcludedContainers` setting, so the- // row stays listed (the list is driven by `updateInfo.hasUpdate`) and only its- // rendering changes once the refreshed rows report the new status back.- async function handleToggleIgnore(item: ContainerUpdateRow) {- const enable = item.ignored;- ignoringContainerIds = { ...ignoringContainerIds, [item.containerId]: true };+ // Disabling writes to the shared `autoUpdateExcludedContainers` setting, so the+ // row stays listed (the list is driven by `updateInfo.hasUpdate`, and checks+ // keep running) and only its rendering changes once the refreshed rows report+ // the new status back.+ async function handleToggleAutoUpdate(item: ContainerUpdateRow) {+ const enable = item.autoUpdateDisabled;+ togglingAutoUpdateIds = { ...togglingAutoUpdateIds, [item.containerId]: true };try {const operationResult = await tryCatch(containerService.setAutoUpdate(item.containerId, enable));if (operationResult.error !== null) {@@ -169,7 +174,7 @@// The setting is saved at this point; a failed reload must not read as a failed toggle.const refreshResult = await tryCatch((async () => {- await onIgnoreChanged?.();+ await onAutoUpdateChanged?.();await refreshRows();})());@@ -179,7 +184,7 @@});}} finally {- ignoringContainerIds = { ...ignoringContainerIds, [item.containerId]: false };+ togglingAutoUpdateIds = { ...togglingAutoUpdateIds, [item.containerId]: false };}}@@ -231,12 +236,18 @@{#snippet NameCell({ item }: { item: ContainerUpdateRow })}<div class="flex items-center gap-2">- <a class="font-medium hover:underline {item.ignored ? 'text-muted-foreground' : ''}" href={`/containers/${item.containerId}`}>+ <a+ class="font-medium hover:underline {item.autoUpdateDisabled ? 'text-muted-foreground' : ''}"+ href={`/containers/${item.containerId}`}+ >{item.name}</a>- {#if item.ignored}- <Badge variant="gray" title={item.labelControlled ? m.auto_update_controlled_by_label() : undefined}>- {m.common_ignored()}+ {#if item.autoUpdateDisabled}+ <Badge+ variant="gray"+ title={item.labelControlled ? m.auto_update_controlled_by_label() : m.auto_update_disabled_checks_continue()}+ >+ {m.updates_auto_update_disabled()}</Badge>{/if}</div>@@ -263,18 +274,18 @@</DropdownMenu.Item><DropdownMenu.Item- onclick={() => handleToggleIgnore(item)}- disabled={item.labelControlled || !item.statusAvailable || !!ignoringContainerIds[item.containerId]}- title={item.ignoreTitle}+ onclick={() => handleToggleAutoUpdate(item)}+ disabled={item.labelControlled || !item.statusAvailable || !!togglingAutoUpdateIds[item.containerId]}+ title={item.autoUpdateTitle}>- {#if ignoringContainerIds[item.containerId]}+ {#if togglingAutoUpdateIds[item.containerId]}<Spinner class="size-4" />- {:else if item.ignored}+ {:else if item.autoUpdateDisabled}<EyeOnIcon class="size-4" />{:else}<EyeOffIcon class="size-4" />{/if}- {item.ignored ? m.common_unignore() : m.common_ignore()}+ {item.autoUpdateDisabled ? m.updates_enable_auto_update() : m.updates_disable_auto_update()}</DropdownMenu.Item></RowActionsMenu></IfPermitted>@@ -289,7 +300,10 @@})}title={(item: ContainerUpdateRow) => item.name}subtitle={(item: ContainerUpdateRow) => item.imageRef}- badges={[(item: ContainerUpdateRow) => (item.ignored ? { variant: 'gray' as const, text: m.common_ignored() } : null)]}+ badges={[+ (item: ContainerUpdateRow) =>+ item.autoUpdateDisabled ? { variant: 'gray' as const, text: m.updates_auto_update_disabled() } : null+ ]}fields={[{label: m.common_current(),diff --git a/tests/spec/updates.spec.ts b/tests/spec/updates.spec.tsindex 11f2b3f44..ad6c31abc 100644--- a/tests/spec/updates.spec.ts+++ b/tests/spec/updates.spec.ts@@ -227,7 +227,7 @@ test.describe('Updates Page Project Rows', () => {});test.describe('Updates Page Actions', () => {- test('accepts updates for the selected container rows, including an ignored one', async ({+ test('accepts updates for the selected container rows, including one with automatic updates disabled', async ({page}) => {await stubContainersWithUpdates(page);@@ -236,7 +236,7 @@ test.describe('Updates Page Actions', () => {await page.goto(UPDATES_ROUTE);await page.waitForLoadState('load');await expect(- containerRow(page, IGNORED_CONTAINER).getByText('Ignored', { exact: true })+ containerRow(page, IGNORED_CONTAINER).getByText('Automatic updates disabled', { exact: true })).toBeVisible();await selectAllContainerRows(page);