Skip to content

EFF-474: Purge imgix after uploading graphics - #541

Merged
tashian merged 2 commits into
mainfrom
carl/graphics-imgix-purge
Jul 27, 2026
Merged

EFF-474: Purge imgix after uploading graphics#541
tashian merged 2 commits into
mainfrom
carl/graphics-imgix-purge

Conversation

@tashian

@tashian tashian commented Jul 27, 2026

Copy link
Copy Markdown
Member

The bug

Graphics changes have not been reaching readers, which is why uploading them by hand in the AWS console became a habit.

The site serves graphics through imgix (smallstep.imgix.net), backed by the CMS images S3 bucket. imgix caches origin objects and does not notice when an object is replaced under the same key — its own docs say to change storage first, then purge. The source is configured Respect origin with a 30-day default TTL, and nothing set a Cache-Control header, so every graphic falls through to 30 days. No imgix purge has ever run.

The fix

A purge step, driven from the same git diff as the upload so the two lists cannot drift.

Verification compares imgix's Last-Modified against the S3 object's own timestamp, not byte size. imgix rewrites SVGs on serve — strips the Illustrator generator comment, rewrites the encoding declaration, reorders attributes — so a correctly purged SVG never matches its origin byte-for-byte. A size check would have warned on all 42 SVGs forever.

Purge returns 200 for "received", not "completed", and imgix guarantees no completion time, so verification is advisory (continue-on-error) and retries in rounds — total wait stays ~50s whether one graphic changed or all 128 did.

Also modernized

The old third-party S3 action is archived-or-stale across the board (jakejarvis/s3-sync-action is archived; shallwefootball/upload-s3-action last saw a commit in June 2024 and is the source of the Node 20 deprecation warnings). AWS publishes no S3 action — the documented pattern is configure-aws-credentials plus the CLI, which is what this does.

  • GitHub OIDC instead of the two access keys from August 2023
  • Only changed files upload, instead of all 128 on every run
  • The role can write only under graphics/* — this bucket is shared with the Strapi CMS
  • No s3:DeleteObject: the bucket has no versioning, so deletes are unrecoverable, and the upside was pruning a few unreferenced objects
  • workflow_dispatch with dry_run and full_sync inputs

Already provisioned

  • Role smallstep-docs-assets-uploader, trust pinned to repo:smallstep/docs:ref:refs/heads/main
  • Repo variables AWS_ASSETS_ROLE_ARN, AWS_REGION, AWS_ASSETS_BUCKET
  • Repo secret IMGIX_API_KEY

After merge

This PR touches no graphics, so it will not trigger itself. Run workflow_dispatch with dry_run first, then full_sync once to clear the backlog, then confirm entra-id-mappings.png goes live.

Retiring the two 2023 access keys stays for a follow-up, once this is verified green.

Testing

  • Changed-file detection verified against the real PRE-168: Update entra id mappings #539 merge and both fallback paths (empty and all-zeros github.event.before) — each yields exactly graphics/entra-id-mappings.png
  • shellcheck clean on all four run blocks; YAML parses
  • Verify logic confirmed against live imgix: correctly flags entra-id-mappings.png and correctly passes autocert-arch.png

🤖 Generated with Claude Code

@tashian
tashian requested a review from a team as a code owner July 27, 2026 18:52
@tashian
tashian force-pushed the carl/graphics-imgix-purge branch 2 times, most recently from 550a192 to 6b44e9c Compare July 27, 2026 19:01
@tashian
tashian enabled auto-merge July 27, 2026 19:05
Updated graphics have not been reaching readers. The workflow uploaded them
to S3 correctly, but the site serves graphics through imgix, which caches
origin objects for 30 days and does not notice that an object was replaced
under the same key. Without a purge the upload is invisible — PR #539's
updated entra-id-mappings.png is still serving the old bytes right now.

Adds a purge step driven from the same git diff as the upload, so the two
lists cannot drift. Verification compares imgix's Last-Modified against the
S3 object's timestamp rather than byte size, because imgix rewrites SVGs on
serve and a correctly purged SVG never matches its origin byte-for-byte.

Also replaces the archived-or-stale third-party S3 action with the AWS CLI
and GitHub OIDC. Uploads are now limited to changed files instead of all 128
every run, and the role can only write under graphics/ — the bucket is
shared with the Strapi CMS. Clears the Node 20 deprecation warnings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tashian
tashian force-pushed the carl/graphics-imgix-purge branch from 6b44e9c to 71f2e85 Compare July 27, 2026 19:07
@tashian tashian changed the title Purge imgix after uploading graphics EFF-474: Purge imgix after uploading graphics Jul 27, 2026
@tashian
tashian merged commit 5e51f70 into main Jul 27, 2026
4 checks passed
@tashian
tashian deleted the carl/graphics-imgix-purge branch July 27, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants