Files
coder/.github
Denis AfonsoandClaude 594bc829c1 ci: keep coder-preview images for 30 days instead of 7 (#30635)
<!--

If you have used AI to produce some or all of this PR, please ensure you
have read our [AI Contribution
guidelines](https://github.com/coder/coder/blob/main/contributing/AI_CONTRIBUTING.md)
before submitting.

-->

Raises `keep-younger-than` in the `Prune old images` step from 7 to 30
days.

## Why

Release-branch builds push per-arch images tagged `v<version>-<arch>`,
then a multi-arch index tagged `<version>` and `release-X.Y`. The prune
step deletes `^v` tags older than 7 days, but it keeps the index because
its tags don't match. After a week, anything pinned to a `release-*`
digest points at an index whose children are gone, and pulls fail.

This took down cdrstable.dev today (coder/dogfood#694) and on Sep 11
(coder/dogfood#524). Running pods were fine until their nodes were
replaced, then every coder and provisioner pod hit `ImagePullBackOff`.

## Evidence

The pinned index still exists:
```
$ curl -sI -H "Authorization: Bearer $T" -H "Accept: application/vnd.oci.image.index.v1+json" \
    https://ghcr.io/v2/coder/coder-preview/manifests/release-2.38
HTTP/2 200
docker-content-digest: sha256:b95a60b623a8f67223fb7dfe6479159b0edb809c96bee70249de152c3edde724
```
Its per-arch children were pruned:
```
v2.37.3-devel-c3c6a67282-amd64                 HTTP/2 404
v2.37.3-devel-c3c6a67282-arm64                 HTTP/2 404
sha256:be71cee3… (amd64 child of the index)    404
```
Kubelet:
```
failed to pull and unpack image "ghcr.io/coder/coder-preview@sha256:b95a60b6…": content at
https://ghcr.io/v2/coder/coder-preview/manifests/sha256:be71cee3… not found
```

## Why 30 days

Stable's longest preview pin has been 14 days, and both outages happened
at day 7+. 30 days is about 2× that.

- **Cost:** `coder-preview` is public, and Container registry storage
and bandwidth are currently free.
- **Size:** about 17 builds a day at about 220 MiB of unshared binary
layer per arch. Storage grows from roughly 75 GiB to roughly 330 GiB.
- **Limits:** GitHub documents no total-storage or version-count limit
for ghcr.

This makes the failure much less likely but doesn't remove it: a kept
index can still outlive its children. A real fix would be an index-aware
prune. Separately, coder/dogfood will add a daily check that every
pinned image is still pullable.

AI disclosure: this PR was prepared with Claude Code. I reviewed the
change and checked the registry state above myself.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 12:58:05 +01:00
..