From 40a0a9fc5ed8ff99ea1dcd611e5cfb39bf050cf7 Mon Sep 17 00:00:00 2001 From: Robert Curth Date: Sat, 24 Oct 2026 16:36:44 +0200 Subject: [PATCH 1/3] Compile the release without the encryption key Ecto dumps a field's default at compile time to validate it. For the encrypted attachments of timeline posts and mentions that encrypts, which needs CONFIG_ENCRYPTION_KEY, and a release reads the key only at runtime, so `mix compile` in the Docker build failed. Skip the default validation, as DeploymentTarget already does for its encrypted config. Co-Authored-By: Claude Opus 5.5 --- lib/feather/fediverse/mention.ex | 8 +++++++- lib/feather/fediverse/timeline_post.ex | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/feather/fediverse/mention.ex b/lib/feather/fediverse/mention.ex index 12524ed5..d1d7af61 100644 --- a/lib/feather/fediverse/mention.ex +++ b/lib/feather/fediverse/mention.ex @@ -34,7 +34,13 @@ defmodule Feather.Fediverse.Mention do field :visibility, Ecto.Enum, values: [:public, :followers, :direct] field :content, Feather.Encrypted.Binary, redact: true field :summary, Feather.Encrypted.Binary, redact: true - field :attachments, Feather.Encrypted.List, default: [], redact: true + + # No default dump at compile time: that needs the key, which a release reads at runtime. + field :attachments, Feather.Encrypted.List, + default: [], + skip_default_validation: true, + redact: true + field :named_accounts, {:array, :string}, default: [] field :published_at, :utc_datetime_usec field :read_at, :utc_datetime_usec diff --git a/lib/feather/fediverse/timeline_post.ex b/lib/feather/fediverse/timeline_post.ex index a83365f2..f93a8e25 100644 --- a/lib/feather/fediverse/timeline_post.ex +++ b/lib/feather/fediverse/timeline_post.ex @@ -25,7 +25,13 @@ defmodule Feather.Fediverse.TimelinePost do field :name, Feather.Encrypted.Binary, redact: true field :content, Feather.Encrypted.Binary, redact: true field :summary, Feather.Encrypted.Binary, redact: true - field :attachments, Feather.Encrypted.List, default: [], redact: true + + # No default dump at compile time: that needs the key, which a release reads at runtime. + field :attachments, Feather.Encrypted.List, + default: [], + skip_default_validation: true, + redact: true + field :named_accounts, {:array, :string}, default: [] field :published_at, :utc_datetime_usec From b619493ed39564daa5ba3eec5cce1d346c777b1a Mon Sep 17 00:00:00 2001 From: Robert Curth Date: Sat, 24 Oct 2026 16:36:44 +0200 Subject: [PATCH 2/3] Build the Docker image on pull requests The image job ran only on main, so a broken Docker build surfaced only after the merge. Pull requests now build the image too, without logging in, pushing or writing the layer cache; main still pushes it and is the only one to write the cache, so pull requests do not evict it. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 14 ++++++++------ Dockerfile | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e960e14..8c8f55f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,21 +102,23 @@ jobs: - name: Build assets run: mix assets.setup && mix assets.deploy - # The release image for ops/compose.yml, only for main and only when the - # other jobs pass. Watchtower on the server pulls :latest at night. + # The release image for ops/compose.yml; Watchtower on the server pulls :latest + # at night. Only main writes the layer cache, so pull requests do not evict it. image: needs: [test, assets] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 permissions: contents: read packages: write + env: + PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v7 - uses: docker/setup-buildx-action@v4 - - uses: docker/login-action@v4 + - if: env.PUBLISH == 'true' + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -134,8 +136,8 @@ jobs: with: context: . platforms: linux/amd64 - push: true + push: ${{ env.PUBLISH == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: ${{ env.PUBLISH == 'true' && 'type=gha,mode=max' || '' }} diff --git a/Dockerfile b/Dockerfile index 5bd6be77..a293eb46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ # syntax=docker/dockerfile:1 # -# Release image of the CMS. CI builds it on main and pushes it to -# ghcr.io/feather-page/cms; it runs with docker compose (ops/compose.yml). +# Release image of the CMS. CI builds it for pull requests and main, and pushes +# it from main to ghcr.io/feather-page/cms; it runs with docker compose +# (ops/compose.yml). # # Volume: /data (SQLite database, image storage and build output). # The container migrates the database on start (bin/server). From e47a08fdd938ef175869e3a8bcba843e68cd23f0 Mon Sep 17 00:00:00 2001 From: Robert Curth Date: Sat, 24 Oct 2026 16:41:05 +0200 Subject: [PATCH 3/3] Build the image one at a time per ref Merges in quick succession started image builds in parallel, so an older build could finish last and push :latest over a newer image, which Watchtower would then deploy. A concurrency group per ref queues them; a newer build replaces a waiting older one. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c8f55f1..829c1da1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,8 @@ jobs: image: needs: [test, assets] runs-on: ubuntu-24.04 + # One build per ref at a time, so an older build cannot push :latest over a newer one. + concurrency: image-${{ github.ref }} permissions: contents: read packages: write