test artifacts retention policy: what to keep
Defines a test artifacts retention policy for QA engineers and agents. Use when artifact storage keeps growing or when nobody can find the video of a failure from last week. Not for log aggregation or production observability retention.
TL;DR
Keep artifacts from failing runs much longer than from passing runs, and keep flakiness history the longest of all. Classify artifacts into videos, screenshots, traces, reports, and logs, give each class its own retention window, and compress or downsample the bulky ones. A policy nobody enforces is just a wish, so put the deletion in the pipeline.
The query
test artifacts retention policy: what to keepUse this when
- Artifact storage costs or quota keep growing
- Debugging an old failure and the video is already gone
- Compliance or security asks how long test data is kept
Not for
- Application logs in production
- Build artifact retention (compiled outputs are separate)
- Backup policy for source code
Steps
- Inventory what you store. List every artifact type the pipeline uploads: videos, screenshots, traces, HTML reports, raw logs, coverage files.
Expected output: a written inventory with current sizes per type.
- Set retention by outcome. A common starting point: failing-run artifacts 30 to 90 days, passing-run artifacts 7 to 14 days, quarantine and flake history 90 days.
Expected output: a table mapping artifact type and run outcome to a retention window.
- Compress the bulky ones. Videos and traces compress well; downsample videos from passing runs or drop them entirely.
Expected output: a storage drop of at least half on the next billing cycle, with failing-run videos untouched.
- Automate deletion. Add a scheduled job that deletes artifacts older than their window. Manual cleanup never happens.
Expected output: a scheduled cleanup job with logs showing deletions per run.
- Document the policy where the team can find it. Link it from the CI docs and the on-call runbook.
Expected output: a policy page linked from the pipeline README, with an owner and a review date.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_hNY6PTc4k4kDB6JqyOWVaw
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.