Skip to content

Modern Docker Management, Designed for Everyone

fix: cut S3 backup download amplification (#3773)

Kyle Mendell538350af6c72
diff --git a/backend/internal/backup/engine.go b/backend/internal/backup/engine.go
index fba3175cb..ed2a9cd06 100644
--- a/backend/internal/backup/engine.go
+++ b/backend/internal/backup/engine.go
@@ -277,9 +277,13 @@ func (e *Engine) ListSnapshots(ctx context.Context, dockerClient *client.Client,
return snapshots, nil
}
-// ForgetSnapshot removes the snapshot from the repository and prunes its data.
-func (e *Engine) ForgetSnapshot(ctx context.Context, dockerClient *client.Client, repository Repository, password, snapshotID string) error {
- _, err := e.runInternal(ctx, dockerClient, repository, password, []string{"forget", "--prune", "--", snapshotID})
+// ForgetSnapshots removes the snapshots from the repository and prunes their
+// data in a single pass.
+func (e *Engine) ForgetSnapshots(ctx context.Context, dockerClient *client.Client, repository Repository, password string, snapshotIDs []string) error {
+ if len(snapshotIDs) == 0 {
+ return errors.New("at least one snapshot ID is required")
+ }
+ _, err := e.runInternal(ctx, dockerClient, repository, password, append([]string{"forget", "--prune", "--"}, snapshotIDs...))
return err
}
diff --git a/backend/internal/config/schema/schema_test.go b/backend/internal/config/schema/schema_test.go
index adc0554c4..97835eef0 100644
--- a/backend/internal/config/schema/schema_test.go
+++ b/backend/internal/config/schema/schema_test.go
@@ -365,7 +365,6 @@ var expectedSettingOverrideKeys = []string{
"trivyImage",
"trivyMemoryLimitMb",
"trivyNetwork",
- "trivyPreserveCacheOnVolumePrune",
"trivyPrivileged",
"trivyResourceLimitsEnabled",
"trivyScanTimeout",
diff --git a/backend/internal/settings/model.go b/backend/internal/settings/model.go
index b2e3a374f..f6a9a60e1 100644
--- a/backend/internal/settings/model.go
+++ b/backend/internal/settings/model.go
@@ -131,7 +131,6 @@ type Settings struct {
TrivyNetwork SettingVariable `key:"trivyNetwork,envOverride" meta:"label=Trivy Network;type=text;keywords=trivy,network,mode,bridge,host,none,scanner,vulnerability,security;category=security;description=Docker network mode/network name used for Trivy scan containers. Leave empty to inherit Arcane's network automatically."`
TrivySecurityOpts SettingVariable `key:"trivySecurityOpts,envOverride" meta:"label=Trivy Security Options;type=textarea;keywords=trivy,security,opt,security_opt,selinux,labels,apparmor,scanner;category=security;description=Docker security options applied to Trivy scan containers. Use commas or new lines to separate entries (for example: label=disable)"`
TrivyPrivileged SettingVariable `key:"trivyPrivileged,envOverride" meta:"label=Trivy Privileged;type=boolean;keywords=trivy,privileged,security,selinux,scanner;category=security;description=Run Trivy scan containers in privileged mode when required by the host security policy"`
- TrivyPreserveCacheOnVolumePrune SettingVariable `key:"trivyPreserveCacheOnVolumePrune,envOverride" meta:"label=Preserve Trivy Cache On Volume Prune;type=boolean;keywords=trivy,cache,volume,prune,preserve,cleanup,security;category=security;description=Keep the Trivy cache volume when unused volumes are pruned manually or on a schedule"`
TrivyResourceLimitsEnabled SettingVariable `key:"trivyResourceLimitsEnabled,envOverride" meta:"label=Trivy Resource Limits;type=boolean;keywords=trivy,resources,limits,cpu,memory,ram,security,scan;category=security;description=Enable CPU and memory limits for Trivy scan containers"`
TrivyCpuLimit SettingVariable `key:"trivyCpuLimit,envOverride" meta:"label=Trivy CPU Limit (cores);type=number;keywords=trivy,cpu,cores,limit,scanner,resources;category=security;description=Maximum CPU cores for Trivy scan containers (supports decimals, e.g. 1.5). Set 0 to disable CPU limit"`
TrivyMemoryLimitMb SettingVariable `key:"trivyMemoryLimitMb,envOverride" meta:"label=Trivy Memory Limit (MB);type=number;keywords=trivy,memory,ram,mb,limit,scanner,resources;category=security;description=Maximum memory for Trivy scan containers in MB. Set 0 to disable memory limit"`
diff --git a/backend/internal/settings/service.go b/backend/internal/settings/service.go
index d473adc10..f5299d1f5 100644
--- a/backend/internal/settings/service.go
+++ b/backend/internal/settings/service.go
@@ -194,91 +194,90 @@ func (s *SettingsService) getDefaultSettings() *Settings {
// DefaultSettingsConfig returns the canonical default settings model used by Arcane.
func DefaultSettingsConfig() *Settings {
return &Settings{
- ProjectsDirectory: SettingVariable{Value: "/app/data/projects"},
- TemplatesDirectory: SettingVariable{Value: "/app/data/templates"},
- FollowProjectSymlinks: SettingVariable{Value: "false"},
- SwarmStackSourcesDirectory: SettingVariable{Value: "/app/data/swarm/sources"},
- DiskUsagePath: SettingVariable{Value: "/app/data/projects"},
- AutoUpdate: SettingVariable{Value: "false"},
- AutoUpdateInterval: SettingVariable{Value: "0 0 0 * * *"},
- AutoUpdateExcludedContainers: SettingVariable{Value: ""},
- PollingEnabled: SettingVariable{Value: "true"},
- PollingInterval: SettingVariable{Value: "0 0 * * * *"},
- ImageEventWatcherEnabled: SettingVariable{Value: "false"},
- DockerClientRefreshInterval: SettingVariable{Value: "*/30 * * * * *"},
- EventCleanupInterval: SettingVariable{Value: "0 0 */6 * * *"},
- ExpiredSessionsCleanupInterval: SettingVariable{Value: "0 0 0 * * *"},
- ActivityHistoryRetentionDays: SettingVariable{Value: "30"},
- ActivityHistoryMaxEntries: SettingVariable{Value: "1000"},
- MaxConcurrentActivities: SettingVariable{Value: "5"},
- AutoInjectEnv: SettingVariable{Value: "false"},
- DefaultDeployPullPolicy: SettingVariable{Value: "missing"},
- ScheduledPruneEnabled: SettingVariable{Value: "false"},
- ScheduledPruneInterval: SettingVariable{Value: "0 0 0 * * *"},
- PruneContainerMode: SettingVariable{Value: "stopped"},
- PruneContainerUntil: SettingVariable{Value: ""},
- PruneImageMode: SettingVariable{Value: "dangling"},
- PruneImageUntil: SettingVariable{Value: ""},
- PruneVolumeMode: SettingVariable{Value: "none"},
- PruneNetworkMode: SettingVariable{Value: "unused"},
- PruneNetworkUntil: SettingVariable{Value: ""},
- PruneBuildCacheMode: SettingVariable{Value: "none"},
- PruneBuildCacheUntil: SettingVariable{Value: ""},
- AutoHealEnabled: SettingVariable{Value: "false"},
- AutoHealInterval: SettingVariable{Value: "*/30 * * * * *"},
- AutoHealExcludedContainers: SettingVariable{Value: ""},
- AutoHealMaxRestarts: SettingVariable{Value: "5"},
- AutoHealRestartWindow: SettingVariable{Value: "30"},
- VolumeHelperIdleTimeout: SettingVariable{Value: "10"},
- BaseServerURL: SettingVariable{Value: "http://localhost"},
- EnableGravatar: SettingVariable{Value: "true"},
- ExperimentalFeaturesEnabled: SettingVariable{Value: "false"},
- AvatarMaxUploadSizeMb: SettingVariable{Value: "2"},
- DefaultShell: SettingVariable{Value: "/bin/sh"},
- DockerHost: SettingVariable{Value: "unix:///var/run/docker.sock"},
- BuildsDirectory: SettingVariable{Value: "/builds"},
- AuthLocalEnabled: SettingVariable{Value: "true"},
- AuthSessionTimeout: SettingVariable{Value: "1440"},
- AuthPasswordPolicy: SettingVariable{Value: "strong"},
- VulnerabilityScanEnabled: SettingVariable{Value: "false"},
- VulnerabilityScanInterval: SettingVariable{Value: "0 0 0 * * *"},
- TrivyImage: SettingVariable{Value: DefaultTrivyImage},
- TrivyNetwork: SettingVariable{Value: ""},
- TrivySecurityOpts: SettingVariable{Value: ""},
- TrivyPrivileged: SettingVariable{Value: "false"},
- TrivyPreserveCacheOnVolumePrune: SettingVariable{Value: "true"},
- TrivyResourceLimitsEnabled: SettingVariable{Value: "true"},
- TrivyCpuLimit: SettingVariable{Value: "1"},
- TrivyMemoryLimitMb: SettingVariable{Value: "0"},
- TrivyConcurrentScanContainers: SettingVariable{Value: "1"},
- TrivyServerEnabled: SettingVariable{Value: "false"},
- TrivyServerUrl: SettingVariable{Value: ""},
- TrivyServerToken: SettingVariable{Value: ""},
- TrivyIgnoreUnfixed: SettingVariable{Value: "true"},
- OidcEnabled: SettingVariable{Value: "false"},
- OidcClientId: SettingVariable{Value: ""},
- OidcClientSecret: SettingVariable{Value: ""},
- OidcIssuerUrl: SettingVariable{Value: ""},
- OidcAuthorizationEndpoint: SettingVariable{Value: ""},
- OidcTokenEndpoint: SettingVariable{Value: ""},
- OidcUserinfoEndpoint: SettingVariable{Value: ""},
- OidcJwksEndpoint: SettingVariable{Value: ""},
- OidcScopes: SettingVariable{Value: "openid email profile"},
- OidcGroupsClaim: SettingVariable{Value: "groups"},
- OidcSkipTlsVerify: SettingVariable{Value: "false"},
- OidcAutoRedirectToProvider: SettingVariable{Value: "false"},
- OidcMergeAccounts: SettingVariable{Value: "false"},
- OidcProviderName: SettingVariable{Value: ""},
- OidcProviderLogoUrl: SettingVariable{Value: ""},
- OidcMobileRedirectUris: SettingVariable{Value: "arcane-mobile://oidc-callback"},
- MaxImageUploadSize: SettingVariable{Value: "500"},
- GitSyncMaxFiles: SettingVariable{Value: "500"},
- GitSyncMaxTotalSizeMb: SettingVariable{Value: "50"},
- GitSyncMaxBinarySizeMb: SettingVariable{Value: "10"},
- EnvironmentHealthInterval: SettingVariable{Value: "0 */2 * * * *"},
- LifecycleEnabled: SettingVariable{Value: "false"},
- LifecycleDefaultRunnerImage: SettingVariable{Value: "alpine:latest"},
- LifecycleMaxTimeoutSec: SettingVariable{Value: "300"},
+ ProjectsDirectory: SettingVariable{Value: "/app/data/projects"},
+ TemplatesDirectory: SettingVariable{Value: "/app/data/templates"},
+ FollowProjectSymlinks: SettingVariable{Value: "false"},
+ SwarmStackSourcesDirectory: SettingVariable{Value: "/app/data/swarm/sources"},
+ DiskUsagePath: SettingVariable{Value: "/app/data/projects"},
+ AutoUpdate: SettingVariable{Value: "false"},
+ AutoUpdateInterval: SettingVariable{Value: "0 0 0 * * *"},
+ AutoUpdateExcludedContainers: SettingVariable{Value: ""},
+ PollingEnabled: SettingVariable{Value: "true"},
+ PollingInterval: SettingVariable{Value: "0 0 * * * *"},
+ ImageEventWatcherEnabled: SettingVariable{Value: "false"},
+ DockerClientRefreshInterval: SettingVariable{Value: "*/30 * * * * *"},
+ EventCleanupInterval: SettingVariable{Value: "0 0 */6 * * *"},
+ ExpiredSessionsCleanupInterval: SettingVariable{Value: "0 0 0 * * *"},
+ ActivityHistoryRetentionDays: SettingVariable{Value: "30"},
+ ActivityHistoryMaxEntries: SettingVariable{Value: "1000"},
+ MaxConcurrentActivities: SettingVariable{Value: "5"},
+ AutoInjectEnv: SettingVariable{Value: "false"},
+ DefaultDeployPullPolicy: SettingVariable{Value: "missing"},
+ ScheduledPruneEnabled: SettingVariable{Value: "false"},
+ ScheduledPruneInterval: SettingVariable{Value: "0 0 0 * * *"},
+ PruneContainerMode: SettingVariable{Value: "stopped"},
+ PruneContainerUntil: SettingVariable{Value: ""},
+ PruneImageMode: SettingVariable{Value: "dangling"},
+ PruneImageUntil: SettingVariable{Value: ""},
+ PruneVolumeMode: SettingVariable{Value: "none"},
+ PruneNetworkMode: SettingVariable{Value: "unused"},
+ PruneNetworkUntil: SettingVariable{Value: ""},
+ PruneBuildCacheMode: SettingVariable{Value: "none"},
+ PruneBuildCacheUntil: SettingVariable{Value: ""},
+ AutoHealEnabled: SettingVariable{Value: "false"},
+ AutoHealInterval: SettingVariable{Value: "*/30 * * * * *"},
+ AutoHealExcludedContainers: SettingVariable{Value: ""},
+ AutoHealMaxRestarts: SettingVariable{Value: "5"},
+ AutoHealRestartWindow: SettingVariable{Value: "30"},
+ VolumeHelperIdleTimeout: SettingVariable{Value: "10"},
+ BaseServerURL: SettingVariable{Value: "http://localhost"},
+ EnableGravatar: SettingVariable{Value: "true"},
+ ExperimentalFeaturesEnabled: SettingVariable{Value: "false"},
+ AvatarMaxUploadSizeMb: SettingVariable{Value: "2"},
+ DefaultShell: SettingVariable{Value: "/bin/sh"},
+ DockerHost: SettingVariable{Value: "unix:///var/run/docker.sock"},
+ BuildsDirectory: SettingVariable{Value: "/builds"},
+ AuthLocalEnabled: SettingVariable{Value: "true"},
+ AuthSessionTimeout: SettingVariable{Value: "1440"},
+ AuthPasswordPolicy: SettingVariable{Value: "strong"},
+ VulnerabilityScanEnabled: SettingVariable{Value: "false"},
+ VulnerabilityScanInterval: SettingVariable{Value: "0 0 0 * * *"},
+ TrivyImage: SettingVariable{Value: DefaultTrivyImage},
+ TrivyNetwork: SettingVariable{Value: ""},
+ TrivySecurityOpts: SettingVariable{Value: ""},
+ TrivyPrivileged: SettingVariable{Value: "false"},
+ TrivyResourceLimitsEnabled: SettingVariable{Value: "true"},
+ TrivyCpuLimit: SettingVariable{Value: "1"},
+ TrivyMemoryLimitMb: SettingVariable{Value: "0"},
+ TrivyConcurrentScanContainers: SettingVariable{Value: "1"},
+ TrivyServerEnabled: SettingVariable{Value: "false"},
+ TrivyServerUrl: SettingVariable{Value: ""},
+ TrivyServerToken: SettingVariable{Value: ""},
+ TrivyIgnoreUnfixed: SettingVariable{Value: "true"},
+ OidcEnabled: SettingVariable{Value: "false"},
+ OidcClientId: SettingVariable{Value: ""},
+ OidcClientSecret: SettingVariable{Value: ""},
+ OidcIssuerUrl: SettingVariable{Value: ""},
+ OidcAuthorizationEndpoint: SettingVariable{Value: ""},
+ OidcTokenEndpoint: SettingVariable{Value: ""},
+ OidcUserinfoEndpoint: SettingVariable{Value: ""},
+ OidcJwksEndpoint: SettingVariable{Value: ""},
+ OidcScopes: SettingVariable{Value: "openid email profile"},
+ OidcGroupsClaim: SettingVariable{Value: "groups"},
+ OidcSkipTlsVerify: SettingVariable{Value: "false"},
+ OidcAutoRedirectToProvider: SettingVariable{Value: "false"},
+ OidcMergeAccounts: SettingVariable{Value: "false"},
+ OidcProviderName: SettingVariable{Value: ""},
+ OidcProviderLogoUrl: SettingVariable{Value: ""},
+ OidcMobileRedirectUris: SettingVariable{Value: "arcane-mobile://oidc-callback"},
+ MaxImageUploadSize: SettingVariable{Value: "500"},
+ GitSyncMaxFiles: SettingVariable{Value: "500"},
+ GitSyncMaxTotalSizeMb: SettingVariable{Value: "50"},
+ GitSyncMaxBinarySizeMb: SettingVariable{Value: "10"},
+ EnvironmentHealthInterval: SettingVariable{Value: "0 */2 * * * *"},
+ LifecycleEnabled: SettingVariable{Value: "false"},
+ LifecycleDefaultRunnerImage: SettingVariable{Value: "alpine:latest"},
+ LifecycleMaxTimeoutSec: SettingVariable{Value: "300"},
DockerAPITimeout: SettingVariable{Value: "30"},
DockerImagePullTimeout: SettingVariable{Value: "600"},
diff --git a/backend/internal/settings/service_test.go b/backend/internal/settings/service_test.go
index bceb0b7c6..657e4e380 100644
--- a/backend/internal/settings/service_test.go
+++ b/backend/internal/settings/service_test.go
@@ -95,7 +95,7 @@ func TestSettingsService_EnsureDefaultSettings_Idempotent(t *testing.T) {
require.Equal(t, count1, count2)
// Spot-check core and automation defaults exist with correct values
- for _, key := range []string{"authLocalEnabled", "projectsDirectory", "followProjectSymlinks", "autoUpdateExcludedContainers", "imageEventWatcherEnabled", "vulnerabilityScanEnabled", "vulnerabilityScanInterval", "trivyImage", "trivyNetwork", "trivySecurityOpts", "trivyPrivileged", "trivyPreserveCacheOnVolumePrune", "trivyResourceLimitsEnabled", "trivyCpuLimit", "trivyMemoryLimitMb", "trivyConcurrentScanContainers", "gitSyncMaxFiles", "gitSyncMaxTotalSizeMb", "gitSyncMaxBinarySizeMb", "lifecycleDefaultRunnerImage"} {
+ for _, key := range []string{"authLocalEnabled", "projectsDirectory", "followProjectSymlinks", "autoUpdateExcludedContainers", "imageEventWatcherEnabled", "vulnerabilityScanEnabled", "vulnerabilityScanInterval", "trivyImage", "trivyNetwork", "trivySecurityOpts", "trivyPrivileged", "trivyResourceLimitsEnabled", "trivyCpuLimit", "trivyMemoryLimitMb", "trivyConcurrentScanContainers", "gitSyncMaxFiles", "gitSyncMaxTotalSizeMb", "gitSyncMaxBinarySizeMb", "lifecycleDefaultRunnerImage"} {
var sv SettingVariable
err := svc.db.WithContext(ctx).Where("key = ?", key).First(&sv).Error
require.NoErrorf(t, err, "missing default key %s", key)
@@ -121,8 +121,6 @@ func TestSettingsService_EnsureDefaultSettings_Idempotent(t *testing.T) {
require.Empty(t, sv.Value)
case "trivyPrivileged":
require.Equal(t, "false", sv.Value)
- case "trivyPreserveCacheOnVolumePrune":
- require.Equal(t, "true", sv.Value)
case "trivyResourceLimitsEnabled":
require.Equal(t, "true", sv.Value)
case "trivyCpuLimit":
@@ -1021,44 +1019,6 @@ func TestSettingsService_UpdateSettings_TrivyRuntimeSecurityDoesNotTriggerTimeou
require.Nil(t, callbackPayload)
}
-func TestSettingsService_UpdateSettings_TrivyPreserveCacheOnVolumePrunePersists(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := newSettingsServiceForTestInternal(t, ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- _, err = svc.UpdateSettings(ctx, settingstypes.Update{TrivyPreserveCacheOnVolumePrune: new("false")})
- require.NoError(t, err)
-
- current, err := svc.GetSettings(ctx)
- require.NoError(t, err)
- require.False(t, current.TrivyPreserveCacheOnVolumePrune.IsTrue())
-
- var stored SettingVariable
- err = svc.db.WithContext(ctx).Where("key = ?", "trivyPreserveCacheOnVolumePrune").First(&stored).Error
- require.NoError(t, err)
- require.Equal(t, "false", stored.Value)
-}
-
-func TestSettingsService_UpdateSettings_TrivyPreserveCacheOnVolumePruneDoesNotTriggerTimeoutCallback(t *testing.T) {
- ctx := context.Background()
- db := setupSettingsTestDB(t)
- svc, err := newSettingsServiceForTestInternal(t, ctx, db)
- require.NoError(t, err)
- require.NoError(t, svc.EnsureDefaultSettings(ctx))
-
- var callbackPayload []libarcane.SettingUpdate
- svc.SubscribeSettingsChanges(libarcane.TimeoutSettingKeys(), func(timeoutSettings []libarcane.SettingUpdate) {
- callbackPayload = timeoutSettings
- })
-
- _, err = svc.UpdateSettings(ctx, settingstypes.Update{TrivyPreserveCacheOnVolumePrune: new("false")})
- require.NoError(t, err)
- waitForSettingsNotificationsInternal(t, svc)
- require.Nil(t, callbackPayload)
-}
-
func TestSettingsService_LoadDatabaseSettings_InternalKeys_EnvMode(t *testing.T) {
// Set env + disable flag
t.Setenv("UI_CONFIGURATION_DISABLED", "true")
diff --git a/backend/internal/systembackup/service.go b/backend/internal/systembackup/service.go
index 0448e9bb9..f80c343cf 100644
--- a/backend/internal/systembackup/service.go
+++ b/backend/internal/systembackup/service.go
@@ -421,7 +421,7 @@ func (s *SystemBackupService) createBackupInternal(ctx context.Context, trigger
return
}
cleanupCtx := context.WithoutCancel(ctx)
- if forgetErr := s.engine.ForgetSnapshot(cleanupCtx, dockerClient, localRepository, recoveryKey, stagedSnapshot.ID); forgetErr != nil {
+ if forgetErr := s.engine.ForgetSnapshots(cleanupCtx, dockerClient, localRepository, recoveryKey, []string{stagedSnapshot.ID}); forgetErr != nil {
slog.WarnContext(cleanupCtx, "failed to remove staged system recovery snapshot", "snapshot_id", stagedSnapshot.ID, "error", forgetErr)
}
}()
@@ -1057,10 +1057,26 @@ func (s *SystemBackupService) DeleteBackup(ctx context.Context, id, recoveryKey
if err != nil {
return err
}
+ return s.deleteRunsInternal(ctx, []*SystemBackupRun{run}, recoveryKey)
+}
+
+// deleteRunsInternal forgets snapshots grouped by repository under the caller's run lease.
+func (s *SystemBackupService) deleteRunsInternal(ctx context.Context, runs []*SystemBackupRun, recoveryKey string) error {
+ var localRuns []*SystemBackupRun
+ remoteGroups := make(map[string][]*SystemBackupRun)
+ for _, run := range runs {
+ if run.LocalSnapshotID != "" {
+ localRuns = append(localRuns, run)
+ }
+ if run.RemoteSnapshotID != "" {
+ remoteGroups[run.S3DestinationID] = append(remoteGroups[run.S3DestinationID], run)
+ }
+ }
// A run without snapshots (a failed attempt) is just a row; deleting it
// needs neither the key nor Rustic.
key := ""
- if run.LocalSnapshotID != "" || run.RemoteSnapshotID != "" {
+ if len(localRuns) > 0 || len(remoteGroups) > 0 {
+ var err error
if key, err = s.recoveryKeyInternal(ctx, recoveryKey); err != nil {
return err
}
@@ -1069,35 +1085,62 @@ func (s *SystemBackupService) DeleteBackup(ctx context.Context, id, recoveryKey
if err != nil {
return err
}
- var deleteErr error
- if run.LocalSnapshotID != "" {
- repository, repoErr := s.localRepositoryInternal(ctx, dockerClient, false)
- if repoErr == nil {
- repoErr = s.engine.ForgetSnapshot(ctx, dockerClient, repository, key, run.LocalSnapshotID)
- }
- if repoErr != nil {
- deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete local snapshot: %w", repoErr))
- } else {
- run.LocalSnapshotID = ""
- }
+ deleteErr := s.forgetLocalSnapshotsInternal(ctx, dockerClient, key, localRuns)
+ for destinationID, group := range remoteGroups {
+ deleteErr = errors.Combine(deleteErr, s.forgetRemoteSnapshotsInternal(ctx, dockerClient, key, destinationID, group))
}
- if run.RemoteSnapshotID != "" {
- repository, repoErr := s.remoteRepositoryInternal(ctx, run.S3DestinationID)
- if repoErr == nil {
- repoErr = s.engine.ForgetSnapshot(ctx, dockerClient, repository, key, run.RemoteSnapshotID)
+ for _, run := range runs {
+ if run.LocalSnapshotID == "" && run.RemoteSnapshotID == "" {
+ if err := s.db.WithContext(ctx).Delete(run).Error; err != nil {
+ deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete system backup record: %w", err))
+ }
+ continue
}
- if repoErr != nil {
- deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete S3 snapshot: %w", repoErr))
- } else {
- run.RemoteSnapshotID, run.S3DestinationID = "", ""
+ run.Error = deleteErr.Error()
+ if saveErr := s.db.WithContext(ctx).Save(run).Error; saveErr != nil {
+ deleteErr = errors.Combine(deleteErr, saveErr)
}
}
- if deleteErr != nil {
- run.Error = deleteErr.Error()
- _ = s.db.WithContext(ctx).Save(run).Error
- return deleteErr
+ return deleteErr
+}
+
+func (s *SystemBackupService) forgetLocalSnapshotsInternal(ctx context.Context, dockerClient *client.Client, key string, runs []*SystemBackupRun) error {
+ if len(runs) == 0 {
+ return nil
+ }
+ snapshotIDs := make([]string, len(runs))
+ for index, run := range runs {
+ snapshotIDs[index] = run.LocalSnapshotID
+ }
+ repository, repoErr := s.localRepositoryInternal(ctx, dockerClient, false)
+ if repoErr == nil {
+ repoErr = s.engine.ForgetSnapshots(ctx, dockerClient, repository, key, snapshotIDs)
+ }
+ if repoErr != nil {
+ return fmt.Errorf("failed to delete local snapshots: %w", repoErr)
+ }
+ for _, run := range runs {
+ run.LocalSnapshotID = ""
+ }
+ return nil
+}
+
+func (s *SystemBackupService) forgetRemoteSnapshotsInternal(ctx context.Context, dockerClient *client.Client, key, destinationID string, runs []*SystemBackupRun) error {
+ snapshotIDs := make([]string, len(runs))
+ for index, run := range runs {
+ snapshotIDs[index] = run.RemoteSnapshotID
}
- return s.db.WithContext(ctx).Delete(run).Error
+ repository, repoErr := s.remoteRepositoryInternal(ctx, destinationID)
+ if repoErr == nil {
+ repoErr = s.engine.ForgetSnapshots(ctx, dockerClient, repository, key, snapshotIDs)
+ }
+ if repoErr != nil {
+ return fmt.Errorf("failed to delete S3 snapshots: %w", repoErr)
+ }
+ for _, run := range runs {
+ run.RemoteSnapshotID, run.S3DestinationID = "", ""
+ }
+ return nil
}
func (s *SystemBackupService) DiscoverRemoteBackups(ctx context.Context, request backuptypes.DiscoverSystemBackupsRequest) (int, error) {
@@ -1574,13 +1617,20 @@ func (s *SystemBackupService) RegisterBackupJobOnStartup(ctx context.Context) {
func (s *SystemBackupService) applyRetentionInternal(ctx context.Context, policyID string, keep int) error {
expired, err := backup.ExpiredRunIDs(ctx, s.db, "system_backup_runs", policyID, keep)
+ if err != nil || len(expired) == 0 {
+ return err
+ }
+ lease, admitted, err := s.engine.TryAcquireRun(ctx, backup.SystemAdmissionScope, systemAdmissionID)
if err != nil {
return err
}
- for _, id := range expired {
- if err := s.DeleteBackup(ctx, id, ""); err != nil {
- return err
- }
+ if !admitted {
+ return ErrSystemBackupAlreadyRunning
}
- return nil
+ defer lease.Release()
+ var runs []*SystemBackupRun
+ if err := s.db.WithContext(ctx).Where("id IN ?", expired).Find(&runs).Error; err != nil {
+ return err
+ }
+ return s.deleteRunsInternal(ctx, runs, "")
}
diff --git a/backend/internal/volume/backup.go b/backend/internal/volume/backup.go
index 5e0b190d2..a1f8b306d 100644
--- a/backend/internal/volume/backup.go
+++ b/backend/internal/volume/backup.go
@@ -766,53 +766,91 @@ func (s *VolumeService) deleteBackupInternal(ctx context.Context, backupID strin
if entry.Format == VolumeBackupFormatArchive {
return s.deleteArchiveBackupInternal(ctx, &entry, user)
}
+ return s.deleteRusticBackupsInternal(ctx, []*VolumeBackup{&entry}, user)
+}
+
+// deleteRusticBackupsInternal forgets snapshots grouped by repository so each repository is pruned once.
+func (s *VolumeService) deleteRusticBackupsInternal(ctx context.Context, entries []*VolumeBackup, user *common.User) error {
dockerClient, err := s.dockerService.GetClient(ctx)
if err != nil {
return err
}
- var deleteErr error
- if entry.LocalSnapshotID != "" {
- repository, repoErr := s.localRusticRepositoryInternal(ctx, dockerClient, false)
- if repoErr == nil {
- repoErr = s.engine.ForgetSnapshot(ctx, dockerClient, repository, s.rusticPasswordInternal(), entry.LocalSnapshotID)
+ var localEntries []*VolumeBackup
+ remoteGroups := make(map[string][]*VolumeBackup)
+ for _, entry := range entries {
+ if entry.LocalSnapshotID != "" {
+ localEntries = append(localEntries, entry)
}
- if repoErr != nil {
- deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete local Rustic snapshot: %w", repoErr))
- } else {
- entry.LocalSnapshotID = ""
+ if entry.RemoteSnapshotID != "" {
+ remoteGroups[entry.S3DestinationID] = append(remoteGroups[entry.S3DestinationID], entry)
}
}
- if entry.RemoteSnapshotID != "" {
- repository, repoErr := s.remoteRusticRepositoryInternal(ctx, entry.S3DestinationID)
- if repoErr == nil {
- repoErr = s.engine.ForgetSnapshot(ctx, dockerClient, repository, s.rusticPasswordInternal(), entry.RemoteSnapshotID)
- }
- if repoErr != nil {
- deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete S3 Rustic snapshot: %w", repoErr))
- } else {
- entry.RemoteSnapshotID = ""
- entry.S3DestinationID = ""
- }
+ deleteErr := s.forgetLocalSnapshotsInternal(ctx, dockerClient, localEntries)
+ for destinationID, group := range remoteGroups {
+ deleteErr = errors.Combine(deleteErr, s.forgetRemoteSnapshotsInternal(ctx, dockerClient, destinationID, group))
}
- if deleteErr != nil {
+ for _, entry := range entries {
+ if entry.LocalSnapshotID == "" && entry.RemoteSnapshotID == "" {
+ if err := s.db.WithContext(ctx).Delete(entry).Error; err != nil {
+ deleteErr = errors.Combine(deleteErr, fmt.Errorf("failed to delete volume backup record: %w", err))
+ continue
+ }
+ s.logBackupDeleteEventInternal(ctx, entry.VolumeName, entry.ID, user)
+ continue
+ }
switch {
case entry.LocalSnapshotID != "" && entry.RemoteSnapshotID != "":
entry.Destination = volumetypes.BackupDestinationLocalS3
case entry.LocalSnapshotID != "":
entry.Destination = volumetypes.BackupDestinationLocal
- case entry.RemoteSnapshotID != "":
+ default:
entry.Destination = volumetypes.BackupDestinationS3
}
entry.Error = deleteErr.Error()
- if saveErr := s.db.WithContext(ctx).Save(&entry).Error; saveErr != nil {
+ if saveErr := s.db.WithContext(ctx).Save(entry).Error; saveErr != nil {
deleteErr = errors.Combine(deleteErr, saveErr)
}
- return deleteErr
}
- if err := s.db.WithContext(ctx).Delete(&entry).Error; err != nil {
- return fmt.Errorf("failed to delete volume backup record: %w", err)
+ return deleteErr
+}
+
+func (s *VolumeService) forgetLocalSnapshotsInternal(ctx context.Context, dockerClient *client.Client, entries []*VolumeBackup) error {
+ if len(entries) == 0 {
+ return nil
+ }
+ snapshotIDs := make([]string, len(entries))
+ for index, entry := range entries {
+ snapshotIDs[index] = entry.LocalSnapshotID
+ }
+ repository, repoErr := s.localRusticRepositoryInternal(ctx, dockerClient, false)
+ if repoErr == nil {
+ repoErr = s.engine.ForgetSnapshots(ctx, dockerClient, repository, s.rusticPasswordInternal(), snapshotIDs)
+ }
+ if repoErr != nil {
+ return fmt.Errorf("failed to delete local Rustic snapshots: %w", repoErr)
+ }
+ for _, entry := range entries {
+ entry.LocalSnapshotID = ""
+ }
+ return nil
+}
+
+func (s *VolumeService) forgetRemoteSnapshotsInternal(ctx context.Context, dockerClient *client.Client, destinationID string, entries []*VolumeBackup) error {
+ snapshotIDs := make([]string, len(entries))
+ for index, entry := range entries {
+ snapshotIDs[index] = entry.RemoteSnapshotID
+ }
+ repository, repoErr := s.remoteRusticRepositoryInternal(ctx, destinationID)
+ if repoErr == nil {
+ repoErr = s.engine.ForgetSnapshots(ctx, dockerClient, repository, s.rusticPasswordInternal(), snapshotIDs)
+ }
+ if repoErr != nil {
+ return fmt.Errorf("failed to delete S3 Rustic snapshots: %w", repoErr)
+ }
+ for _, entry := range entries {
+ entry.RemoteSnapshotID = ""
+ entry.S3DestinationID = ""
}
- s.logBackupDeleteEventInternal(ctx, entry.VolumeName, backupID, user)
return nil
}
@@ -1657,15 +1695,14 @@ func (s *VolumeService) UpdateBackupPolicies(ctx context.Context, volumeName str
func (s *VolumeService) applyVolumeBackupRetentionInternal(ctx context.Context, policyID string, retentionCount int) error {
expired, err := backup.ExpiredRunIDs(ctx, s.db, "volume_backups", policyID, retentionCount)
- if err != nil {
+ if err != nil || len(expired) == 0 {
return err
}
- for _, id := range expired {
- if err := s.deleteBackupInternal(ctx, id, nil); err != nil {
- return err
- }
+ var entries []*VolumeBackup
+ if err := s.db.WithContext(ctx).Where("id IN ?", expired).Find(&entries).Error; err != nil {
+ return err
}
- return nil
+ return s.deleteRusticBackupsInternal(ctx, entries, nil)
}
func (s *VolumeService) runScheduledBackupInternal(ctx context.Context, policyID string) {
diff --git a/backend/internal/volume/service.go b/backend/internal/volume/service.go
index 883767d19..6a85fbe08 100644
--- a/backend/internal/volume/service.go
+++ b/backend/internal/volume/service.go
@@ -73,7 +73,7 @@ type volumeWorkspaceLockContextInternal struct {
volumeName string
}
-const trivyCacheVolumePruneFilterValue = libarcane.InternalResourceLabel + "=true"
+const internalVolumePruneFilterValue = libarcane.InternalResourceLabel + "=true"
func NewVolumeService(db *database.DB, dockerService *docker.DockerClientService, eventService *event.EventService, activityService *activity.ActivityService, settingsService *settings.SettingsService, containerService *container.ContainerService, imageService *image.ImageService, engine *backup.Engine, s3Destinations *s3domain.S3DestinationService, cfg *config.Config) *VolumeService {
slog.Debug("volume service: new")
@@ -239,19 +239,16 @@ func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (
// volume. Helpers are re-created on demand on the next browse request.
s.CleanupHelperContainers(ctx)
- preserveTrivyCache := s.preserveTrivyCacheOnVolumePruneInternal()
-
// Docker's VolumesPrune behavior (API v1.42+):
// - Without 'all' flag: Only removes anonymous (unnamed) volumes that are not in use
// - With 'all=true' flag: Removes ALL unused volumes (both named and anonymous)
// Note: Volumes are considered "in use" if referenced by any container (running or stopped)
- volumePruneOptions := buildVolumePruneOptionsInternal(all, preserveTrivyCache)
- volumePruneResult, err := dockerClient.VolumePrune(ctx, volumePruneOptions)
+ volumePruneResult, err := dockerClient.VolumePrune(ctx, buildVolumePruneOptionsInternal(all))
if err != nil {
return nil, errors.WrapIf(err, "failed to prune volumes")
}
- metadata := buildVolumePruneMetadataInternal(all, len(volumePruneResult.Report.VolumesDeleted), volumePruneResult.Report.SpaceReclaimed, preserveTrivyCache)
+ metadata := buildVolumePruneMetadataInternal(all, len(volumePruneResult.Report.VolumesDeleted), volumePruneResult.Report.SpaceReclaimed)
if logErr := s.eventService.LogVolumeEvent(ctx, event.EventTypeVolumeDelete, "", "bulk_prune", common.SystemUser.ID, common.SystemUser.Username, "0", metadata); logErr != nil {
slog.WarnContext(ctx, "could not log volume prune action", "error", logErr.Error())
}
@@ -269,36 +266,18 @@ func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (
}, nil
}
-func (s *VolumeService) preserveTrivyCacheOnVolumePruneInternal() bool {
- if s.settingsService == nil {
- return true
- }
-
- return s.settingsService.GetSettingsConfig().TrivyPreserveCacheOnVolumePrune.IsTrue()
-}
-
-func buildVolumePruneOptionsInternal(all, preserveTrivyCache bool) client.VolumePruneOptions {
- options := client.VolumePruneOptions{
- All: all,
- }
- if !preserveTrivyCache {
- return options
- }
-
+func buildVolumePruneOptionsInternal(all bool) client.VolumePruneOptions {
filters := make(client.Filters)
- filters = filters.Add("label!", trivyCacheVolumePruneFilterValue)
- options.Filters = filters
-
- return options
+ filters = filters.Add("label!", internalVolumePruneFilterValue)
+ return client.VolumePruneOptions{All: all, Filters: filters}
}
-func buildVolumePruneMetadataInternal(all bool, volumesDeleted int, spaceReclaimed uint64, preserveTrivyCache bool) database.JSON {
+func buildVolumePruneMetadataInternal(all bool, volumesDeleted int, spaceReclaimed uint64) database.JSON {
return database.JSON{
- "action": "prune",
- "all": all,
- "volumesDeleted": volumesDeleted,
- "spaceReclaimed": spaceReclaimed,
- "preserveTrivyCache": preserveTrivyCache,
- "trivyCacheFilterLabel": trivyCacheVolumePruneFilterValue,
+ "action": "prune",
+ "all": all,
+ "volumesDeleted": volumesDeleted,
+ "spaceReclaimed": spaceReclaimed,
+ "internalVolumeFilterLabel": internalVolumePruneFilterValue,
}
}
diff --git a/backend/internal/volume/service_test.go b/backend/internal/volume/service_test.go
index c8e788662..d129086b7 100644
--- a/backend/internal/volume/service_test.go
+++ b/backend/internal/volume/service_test.go
@@ -348,38 +348,30 @@ func TestRenameVolumeMetadataInternalPreservesPoliciesAndHistory(t *testing.T) {
require.Equal(t, "renamed-data", backupEntry.VolumeName)
}
-func TestBuildVolumePruneOptionsInternal_PreservesTrivyCache(t *testing.T) {
- options := buildVolumePruneOptionsInternal(true, true)
+func TestBuildVolumePruneOptionsInternal_PreservesInternalVolumes(t *testing.T) {
+ options := buildVolumePruneOptionsInternal(true)
require.True(t, options.All)
require.NotNil(t, options.Filters)
- require.True(t, options.Filters["label!"][trivyCacheVolumePruneFilterValue])
+ require.True(t, options.Filters["label!"][internalVolumePruneFilterValue])
}
-func TestBuildVolumePruneOptionsInternal_PreservesTrivyCacheForAnonymousVolumes(t *testing.T) {
- options := buildVolumePruneOptionsInternal(false, true)
+func TestBuildVolumePruneOptionsInternal_PreservesInternalVolumesForAnonymousVolumes(t *testing.T) {
+ options := buildVolumePruneOptionsInternal(false)
require.False(t, options.All)
require.NotNil(t, options.Filters)
- require.True(t, options.Filters["label!"][trivyCacheVolumePruneFilterValue])
-}
-
-func TestBuildVolumePruneOptionsInternal_DisabledPreservationOmitsFilter(t *testing.T) {
- options := buildVolumePruneOptionsInternal(true, false)
-
- require.True(t, options.All)
- require.Nil(t, options.Filters)
+ require.True(t, options.Filters["label!"][internalVolumePruneFilterValue])
}
func TestBuildVolumePruneMetadataInternal(t *testing.T) {
- metadata := buildVolumePruneMetadataInternal(true, 2, 4096, true)
+ metadata := buildVolumePruneMetadataInternal(true, 2, 4096)
require.Equal(t, "prune", metadata["action"])
require.Equal(t, true, metadata["all"])
require.Equal(t, 2, metadata["volumesDeleted"])
require.EqualValues(t, 4096, metadata["spaceReclaimed"])
- require.Equal(t, true, metadata["preserveTrivyCache"])
- require.Equal(t, trivyCacheVolumePruneFilterValue, metadata["trivyCacheFilterLabel"])
+ require.Equal(t, internalVolumePruneFilterValue, metadata["internalVolumeFilterLabel"])
}
func TestResolveBackupStorageMountFromMountsInternal(t *testing.T) {
diff --git a/backend/pkg/libarcane/rustic/image.go b/backend/pkg/libarcane/rustic/image.go
index c52487117..21ee4b295 100644
--- a/backend/pkg/libarcane/rustic/image.go
+++ b/backend/pkg/libarcane/rustic/image.go
@@ -3,3 +3,6 @@ package rustic
// DefaultImage is the official Rustic container image used by backup and recovery flows.
const DefaultImage = "ghcr.io/rustic-rs/rustic:v0.11.2"
+
+// CacheVolume persists Rustic's repository cache across ephemeral runtime containers.
+const CacheVolume = "arcane-rustic-cache"
diff --git a/backend/pkg/libarcane/rustic/run.go b/backend/pkg/libarcane/rustic/run.go
index a42917e20..c9d2b413f 100644
--- a/backend/pkg/libarcane/rustic/run.go
+++ b/backend/pkg/libarcane/rustic/run.go
@@ -18,15 +18,21 @@ import (
// invocation contract, shared by the backup engine and the detached recovery
// helper; the image must already be present. The standard RUSTIC_* variables
// are appended to environment, and networkMode is applied verbatim ("" keeps
-// the default network).
+// the default network). Every run mounts the shared CacheVolume.
func Run(ctx context.Context, dockerClient *client.Client, password string, command, environment []string, mounts []mount.Mount, networkMode container.NetworkMode) (string, error) {
+ if _, err := dockerClient.VolumeCreate(ctx, client.VolumeCreateOptions{Name: CacheVolume, Labels: volumehelper.Labels()}); err != nil {
+ return "", fmt.Errorf("failed to provision Rustic cache volume: %w", err)
+ }
env := append([]string{}, environment...)
env = append(env,
"RUSTIC_PASSWORD="+password,
"RUSTIC_NO_PROGRESS=true",
"RUSTIC_LOG_LEVEL=error",
+ "RUSTIC_CACHE_DIR=/cache",
)
- hostConfig := volumehelper.HostConfig(DefaultImage, nil, mounts)
+ allMounts := append([]mount.Mount{}, mounts...)
+ allMounts = append(allMounts, mount.Mount{Type: mount.TypeVolume, Source: CacheVolume, Target: "/cache"})
+ hostConfig := volumehelper.HostConfig(DefaultImage, nil, allMounts)
hostConfig.AutoRemove = false
hostConfig.NetworkMode = networkMode
created, err := dockerClient.ContainerCreate(ctx, client.ContainerCreateOptions{
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 69fcef1d6..7de88504d 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1534,8 +1534,6 @@
"security_trivy_privileged_label": "Trivy Privileged",
"security_trivy_privileged_description": "Run Trivy scan containers in privileged mode when the host security policy requires it.",
"security_trivy_privileged_note": "Use this only as a fallback when security options are not sufficient.",
- "security_trivy_preserve_cache_on_volume_prune_label": "Preserve Trivy Cache On Volume Prune",
- "security_trivy_preserve_cache_on_volume_prune_description": "Keep the Trivy cache volume when Arcane prunes unused Docker volumes.",
"security_trivy_network_fetch_failed": "Could not load Docker networks; showing built-in options only.",
"security_trivy_resource_limits_label": "Trivy Resource Limits",
"security_trivy_resource_limits_description": "Configure CPU and memory limits for Trivy scan containers.",
diff --git a/frontend/src/lib/components/settings/trivy-security-settings.svelte b/frontend/src/lib/components/settings/trivy-security-settings.svelte
index 0c31a9f0d..0a5ebed45 100644
--- a/frontend/src/lib/components/settings/trivy-security-settings.svelte
+++ b/frontend/src/lib/components/settings/trivy-security-settings.svelte
@@ -20,7 +20,6 @@
| 'trivyNetwork'
| 'trivySecurityOpts'
| 'trivyPrivileged'
- | 'trivyPreserveCacheOnVolumePrune'
| 'trivyResourceLimitsEnabled'
| 'trivyCpuLimit'
| 'trivyMemoryLimitMb'
@@ -271,14 +270,6 @@
</Alert.Root>
{/if}
- <SettingsRow
- label={m.security_trivy_preserve_cache_on_volume_prune_label()}
- description={m.security_trivy_preserve_cache_on_volume_prune_description()}
- layout="inline"
- >
- <Switch id="trivyPreserveCacheOnVolumePruneSwitch" bind:checked={$formInputs.trivyPreserveCacheOnVolumePrune.value} />
- </SettingsRow>
-
<div class="space-y-4">
<SettingsRow
label={m.security_trivy_resource_limits_label()}
diff --git a/frontend/src/lib/types/settings.ts b/frontend/src/lib/types/settings.ts
index 21ced98c5..004b953db 100644
--- a/frontend/src/lib/types/settings.ts
+++ b/frontend/src/lib/types/settings.ts
@@ -70,7 +70,6 @@ export type Settings = {
trivyNetwork: string;
trivySecurityOpts: string;
trivyPrivileged: boolean;
- trivyPreserveCacheOnVolumePrune: boolean;
trivyResourceLimitsEnabled: boolean;
trivyCpuLimit: number;
trivyMemoryLimitMb: number;
diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
index 402be6682..dc60f185f 100644
--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte
@@ -283,7 +283,6 @@
trivyNetwork: settings?.trivyNetwork || '',
trivySecurityOpts: settings?.trivySecurityOpts || '',
trivyPrivileged: settings?.trivyPrivileged ?? false,
- trivyPreserveCacheOnVolumePrune: settings?.trivyPreserveCacheOnVolumePrune ?? true,
trivyResourceLimitsEnabled: settings?.trivyResourceLimitsEnabled ?? true,
trivyCpuLimit: settings?.trivyCpuLimit ?? 1,
trivyMemoryLimitMb: settings?.trivyMemoryLimitMb ?? 0,
@@ -349,7 +348,6 @@
trivyNetwork: formData.trivyNetwork,
trivySecurityOpts: formData.trivySecurityOpts,
trivyPrivileged: formData.trivyPrivileged,
- trivyPreserveCacheOnVolumePrune: formData.trivyPreserveCacheOnVolumePrune,
trivyResourceLimitsEnabled: formData.trivyResourceLimitsEnabled,
trivyCpuLimit: formData.trivyResourceLimitsEnabled ? formData.trivyCpuLimit : 0,
trivyMemoryLimitMb: formData.trivyResourceLimitsEnabled ? formData.trivyMemoryLimitMb : 0,
diff --git a/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts b/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts
index 676abe917..5361b9fe0 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts
+++ b/frontend/src/routes/(app)/environments/[id]/components/environment-form-schema.ts
@@ -37,7 +37,6 @@ export const environmentFormSchema = z
trivyNetwork: z.string(),
trivySecurityOpts: z.string(),
trivyPrivileged: z.boolean(),
- trivyPreserveCacheOnVolumePrune: z.boolean(),
trivyResourceLimitsEnabled: z.boolean(),
trivyCpuLimit: z.coerce.number().int(m.security_session_timeout_integer()).nonnegative(),
trivyMemoryLimitMb: z.coerce.number().int().nonnegative(),
diff --git a/types/settings/settings.go b/types/settings/settings.go
index 1c335c097..c60606b0d 100644
--- a/types/settings/settings.go
+++ b/types/settings/settings.go
@@ -300,11 +300,6 @@ type Update struct {
// Required: false
TrivyPrivileged *string `json:"trivyPrivileged,omitzero"`
- // TrivyPreserveCacheOnVolumePrune controls whether the Trivy cache volume is excluded from manual and scheduled volume prune runs.
- //
- // Required: false
- TrivyPreserveCacheOnVolumePrune *string `json:"trivyPreserveCacheOnVolumePrune,omitzero"`
-
// TrivyResourceLimitsEnabled controls whether CPU and memory limits are applied to Trivy scan containers.
//
// Required: false