Retention and garbage collection
LodeBase never deletes history: every changeset of every branch stays. What it does clean up:
- Pipeline runs, logs and artifacts, by age (retention).
- Objects nothing references: uploads from submits that were refused or abandoned, files of deleted shelves, and artifacts that retention removed (garbage collection).
- Pool download caches no job has used for a while, and records of stopped environments.
Both run together once a day (LODEBASE_GC_INTERVAL_HOURS, default 24; the first run is 10 minutes after the server starts). Server admins can run them any time:
sh
lode admin gc --dry-run # what would go; removes nothing
lode admin gc # do it
lode admin gc-status # the last run, and when the next one isRetention
| Setting | Default | What it keeps |
|---|---|---|
LODEBASE_RETAIN_RUNS_DAYS | 90 | finished runs, with their jobs, logs and artifacts (at least 32 days: shared runner minutes are counted from them) |
LODEBASE_RETAIN_ARTIFACTS_DAYS | 30 | artifacts |
LODEBASE_RETAIN_LOGS_DAYS | 30 | job logs (the job stays, with "log removed by retention") |
LODEBASE_CACHE_RETAIN_DAYS | 14 | pool download caches since a job last used them |
0 means forever. Whatever the age, these always stay:
- the latest finished run, and the latest successful run, of each pipeline on each branch, and the artifacts of that latest successful run (so "download the latest build" keeps working);
- runs of open merge requests and of merge requests in the queue;
- runs someone kept:
lode pipeline keep 412(maintainers;--offto undo).
Repo admins override the server defaults per repo:
sh
lode retention show
lode retention set --artifacts 7 --logs 14 # days
lode retention set --runs forever
lode retention set --logs default # back to the server'sGarbage collection
Each repo records which objects (file chunks, file manifests, folders, changesets) it holds; that's what counts against its storage limit. GC walks everything a repo still references (every changeset, branch heads, shelves, merge request revisions, pipeline runs and artifacts) and drops the rest of the repo's records, which frees the space from its limit right away. An object no repo records any more is then deleted from the object store. Last, GC lists the object store for objects no repo ever recorded (an upload refused for a storage limit, or cut off) and deletes those too (LODEBASE_GC_SWEEP_STORAGE=false skips this listing, which is the slow part on a very large S3 bucket).
Safety:
- Grace period. Objects uploaded in the last
LODEBASE_GC_GRACE_HOURS(default 24) are never collected, so a submit or shelf that's still uploading, or waiting on a conflict, keeps its files. - Writes in flight. Uploads, submits, shelves, merges and artifacts hold off the collector while they store and record objects. Before removing anything from a repo, GC looks again at whatever that repo referenced while it was walking.
- Missing objects stop it. If a repo references an object the store doesn't have, GC skips that repo entirely (and says so in the report) instead of guessing.
- Backups pause deletes. While
deploy/backup/lodebase-backup.shruns, nothing is deleted from the object store (rows are still released); a later run deletes it. See backup.md. - One collector. The hold-off works within one server process. If you run several API nodes behind a load balancer, give GC to one node and set
LODEBASE_GC_INTERVAL_HOURS=0on the others, and run it when uploads are quiet. Back up before the first GC on a big, old server: see backup.md.