How long should we keep .sdods/runs around? It is 40 GB now
Asked 8,120 views2 answers
25votes
Nobody set a retention policy when we turned this on and the build agent is now 40 GB of .sdods/runs, almost all of it step screenshots. I do not want to rm -rf blindly because we ingest into the database and I assume something in there points at those files.
Is there a supported way to prune, and what does the database lose when the directories go?
That deletes old runs and their artifact directories, so the rows and the files stay in step. Doing it the other way round — rm -rf first — leaves artifact rows pointing at paths that no longer exist. Nothing crashes; the run viewer just shows broken images forever and nobody can tell whether that run had screenshots or not.
On the agent itself I would not keep 200. A build machine wants two or three runs so a rerun can be compared; anything worth keeping longer is the ingested rows plus whatever CI archived.
The size is almost entirely the screenshot policy. @regression captures before and after every UI step by design, @smoke and @sanity only capture scenario start and end. If a suite is tagged @regression because it is big rather than because anyone reads the narratives, that is where your 40 GB came from — and retagging it is a bigger win than any retention setting.
Also worth pointing SDODS_ARTIFACTS_DIR at a scratch disk on the agent instead of the workspace. The whole tree moves, run ids do not change, and ingest still finds the artifacts because it is handed the same root.
We keep three runs on the agent and ninety days in the database. In two years nobody has asked for the screenshots of a run older than about a week.