Skip to content

Retention

Per-feed retention bounds storage on busy CI feeds by hard-deleting old/excess package versions. Off by default — deletion is irreversible.

  1. Per-feed policy — set on /admin/feeds (the Retention editor) or via PUT /api/admin/feeds/{slug}/retention. A feed with no policy (or a disabled one) is never pruned.
  2. Worker master switchNUGETKEEP_RETENTION_ENABLED (default false). When off, no periodic sweeps run; admins can still preview and run retention on demand from the editor/endpoints.

A policy may set either or both:

  • Keep latest N — keep the N most-recent versions per package id.
  • Max age (days) — prune versions older than D days.

A version is a prune candidate if it exceeds keep-N or is older than max-age.

  • The newest stable and newest prerelease of every id are never pruned.
  • Prereleases only by default — stable releases are pruned only if the policy sets include stable (and even then the newest stable is kept).
  • Dependency targets are never pruned — a version that another package in the feed depends on (range-aware, via the dependency graph) is protected.
  • Preview before applying — the editor and POST .../retention/preview show exactly which versions would be pruned, deleting nothing.
  • Every deletion writes an audit entry (retention-prune).

For each selected version: the .nupkg blob, its metadata row, its indexed symbols, its dependency edges, and its download counts. The sweep is resilient — a per-version failure is logged and skipped, and a re-run is idempotent (nothing left to prune).

VariableMeaningDefault
NUGETKEEP_RETENTION_ENABLEDRun the periodic retention worker.false
NUGETKEEP_RETENTION_INTERVALSweep cadence (TimeSpan or seconds).24:00:00
  • GET /api/admin/feeds/{slug}/retention — current policy.
  • PUT /api/admin/feeds/{slug}/retention — set ({ enabled, keepLatest?, maxAgeDays?, includeStable }).
  • DELETE /api/admin/feeds/{slug}/retention — clear.
  • POST /api/admin/feeds/{slug}/retention/preview — dry-run (returns the targets; deletes nothing).
  • POST /api/admin/feeds/{slug}/retention/run — apply now.