Skip to content

chore(infra): prune dotcom-deploy-assets-cache R2 bucket for closed PRs#8746

Merged
MitjaBezensek merged 3 commits into
mainfrom
mitja/prune
May 20, 2026
Merged

chore(infra): prune dotcom-deploy-assets-cache R2 bucket for closed PRs#8746
MitjaBezensek merged 3 commits into
mainfrom
mitja/prune

Conversation

@MitjaBezensek
Copy link
Copy Markdown
Collaborator

@MitjaBezensek MitjaBezensek commented May 4, 2026

The prune-preview-deploys workflow already tears down preview workers, Supabase branches, fly.io zero-cache apps, and Zero litestream R2 backups, but it didn't touch dotcom-deploy-assets-cache — the R2 bucket where coalesceWithPreviousAssets (internal/scripts/deploy-dotcom.ts:957) writes a tarball per deploy. Closed PRs were leaving pr-<n>/ folders behind forever.

This PR adds a fifth prune pass over that bucket, reusing the existing closed-for-2-days filter via processItems. Since both R2 prunes were near-duplicates, I refactored them into shared listR2PrPrefixes / deleteR2Prefix helpers parameterized by an R2BucketRef ({client, bucket, label}). Adding more buckets in future is one literal each. Net diff is +43/-80.

staging/ and production/ prefixes are intentionally untouched — they're required by coalesceWithPreviousAssets for rollback safety.

Also broadens the fly.io app regex from ^pr-\d+-zero-cache$ to ^pr-\d+-zero-(cache|rm|vs)$ so preview zero-rm and zero-vs apps get torn down alongside zero-cache. Without this, the leftover apps kept writing new litestream backups into already-pruned pr-<n>/ prefixes in the Zero R2 bucket, so the same prefix kept reappearing in nightly runs.

Closes #8745.

Change type

  • other

Test plan

  • Workflow runs daily on cron; will be exercised on the next scheduled run after merge. Reuses the same R2_ACCESS_KEY_ID / R2_ACCESS_KEY_SECRET secrets the dotcom deploy job already uses for this bucket, so no new secrets needed.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat-template Ready Ready Preview May 20, 2026 8:30am
examples Ready Ready Preview May 20, 2026 8:30am
tldraw-docs Ready Ready Preview May 20, 2026 8:30am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Preview May 20, 2026 8:30am
tldraw-new Ignored Ignored Preview May 20, 2026 8:30am
tldraw-shader Ignored Ignored Preview May 20, 2026 8:30am
workflow-template Ignored Ignored Preview May 20, 2026 8:30am

Request Review

@MitjaBezensek MitjaBezensek requested a review from mimecuvalo May 4, 2026 09:55
@huppy-bot huppy-bot Bot added the other ⚙️ Changes that don't affect SDK users, e.g. internal or .com changes label May 4, 2026
This should catch any multinode deploys we might do for previews.
@vercel vercel Bot temporarily deployed to Preview – tldraw-shader May 11, 2026 12:31 Inactive
@vercel vercel Bot temporarily deployed to Preview – workflow-template May 11, 2026 12:31 Inactive
return preview.map((b) => b.name)
}
const ZERO_CACHE_APP_REGEX = /^pr-\d+-zero-cache$/
const ZERO_CACHE_APP_REGEX = /^pr-\d+-zero-(cache|rm|vs)$/
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to catch both single as well as multinode previews.

Copy link
Copy Markdown
Member

@mimecuvalo mimecuvalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry for the delay, LGTM

# Conflicts:
#	.github/workflows/prune-preview-deploys.yml
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
multiplayer-template 53bed7a May 20 2026, 08:25 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
branching-chat-template 53bed7a Commit Preview URL

Branch Preview URL
May 20 2026, 08:26 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
tldraw-mcp-app 53bed7a May 20 2026, 08:24 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
agent-template 53bed7a May 20 2026, 08:26 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
image-pipeline-template 53bed7a Commit Preview URL

Branch Preview URL
May 20 2026, 08:25 AM

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

Labels

other ⚙️ Changes that don't affect SDK users, e.g. internal or .com changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prune preview deploys script doesn't clean up dotcom-deploy-assets-cache R2 bucket

2 participants