Skip to content

feat(preprod): Delete artifacts when they expire - #132004

Draft
lcian wants to merge 4 commits into
lcian/feat/preprod-expiry-readsfrom
lcian/feat/preprod-expiry-cleanup
Draft

lcian wants to merge 4 commits into
lcian/feat/preprod-expiry-readsfrom
lcian/feat/preprod-expiry-cleanup

Conversation

@lcian

@lcian lcian commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

cleanup deletes every preprod artifact at one fixed age, the --days of the cron that runs it: 396 on the multi-tenant cells and 90 on the single-tenant ones. It now deletes an artifact once it is past the date_expires that was stamped on it at creation.

PreprodArtifact joins the models with a per-record expiry, which cleanup deletes whatever --days is. The cron arguments in ops therefore do not change, and single-tenant cells get the same rule from their generic cleanup run. On those cells a build is now kept for its retention instead of 90 days, which uses more storage there.

Developer plan. Both retentions are 30 days on the Developer plan, which has no Build Distribution, so its builds are now deleted 30 days after the upload instead of after 396 days. The first cleanup run after the backfill deletes the existing builds of Developer organizations that are older than 30 days, including builds uploaded on a trial or a paid plan before the organization moved to Developer. How many rows that first run deletes has not been measured.

Rows without a date are still deleted by age, at --days. That covers rows that are not backfilled yet, which on a self-hosted instance is every row created before the upgrade. This is therefore safe to deploy before the backfill has finished, and no row can stay forever.

Objectstore and EAP. The deletion task now uses the path that a deletion requested by a user already uses, which also removes the artifact's snapshot objects from Objectstore and its trace items from EAP. This adds one EAP delete request per project to each chunk of 100 artifacts that the hourly cron deletes.

Refs EME-1314

Cross-repository landing order (top to bottom)

  • sentry#132001 — Read preprod retention through one helper, capped at 396 days
  • sentry#132002 — Add the expiry columns and stamp them when an artifact is created
  • getsentry#23481 — Add the job that backfills the expiry of existing artifacts
  • sentry#132003 — Read the expiry from the row, and keep a build visible until it expires
  • 👉 sentry#132004 — Delete artifacts in cleanup once they are past their stamped expiry
  • ops#25816 — Explain what --days still does on the preprod artifacts cleanup cron
  • sentry-docs#20923 — Add Build Distribution to the public data retention page

cleanup deleted every PreprodArtifact at a fixed age, the --days of the cron that runs it. It now deletes an artifact once it is past the date_expires stamped on it at creation, whatever --days is, like the other models with a per-record expiry.

An artifact without a date_expires is still deleted by age. That covers rows that are not backfilled yet and rows created under an unlimited retention, so no row can be left behind forever.

The deletion task now also removes the artifact's snapshot objects from Objectstore and its trace items from EAP, as a deletion requested by a user already does.

Refs EME-1314
@linear-code

linear-code Bot commented Nov 20, 2026

Copy link
Copy Markdown

EME-1314

@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 1034 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant