Commit 1645a2d
authored
chore(infra): prune dotcom-deploy-assets-cache R2 bucket for closed PRs (tldraw#8746)
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 tldraw#8745.
### Change type
- [x] `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.1 parent 1d99b68 commit 1645a2d
2 files changed
Lines changed: 52 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
200 | 199 | | |
201 | | - | |
| 200 | + | |
202 | 201 | | |
203 | 202 | | |
204 | 203 | | |
205 | | - | |
| 204 | + | |
206 | 205 | | |
207 | | - | |
| 206 | + | |
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
| |||
218 | 217 | | |
219 | 218 | | |
220 | 219 | | |
221 | | - | |
222 | | - | |
| 220 | + | |
| 221 | + | |
223 | 222 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 223 | + | |
230 | 224 | | |
231 | 225 | | |
232 | | - | |
| 226 | + | |
233 | 227 | | |
234 | | - | |
| 228 | + | |
235 | 229 | | |
236 | 230 | | |
237 | 231 | | |
| |||
243 | 237 | | |
244 | 238 | | |
245 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
246 | 267 | | |
247 | 268 | | |
248 | 269 | | |
| |||
252 | 273 | | |
253 | 274 | | |
254 | 275 | | |
255 | | - | |
256 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
257 | 283 | | |
258 | 284 | | |
259 | 285 | | |
| |||
0 commit comments