CI: strong throwaway JWT_SECRET in the smoke test; registry token; image job on PRs
ci / lint (pull_request) Successful in 9s
ci / nox (pull_request) Successful in 11s
ci / server (mysql) (pull_request) Successful in 14s
ci / server (sqlite) (pull_request) Successful in 13s
ci / client (pull_request) Successful in 29s
ci / image (pull_request) Successful in 14s
ci / sourcemaps (pull_request) Skipped
ci / deploy (pull_request) Skipped
ci / sidecar (pull_request) Successful in 47s

Closes #39. The sqlite boot smoke test passed a 21-character JWT_SECRET
and the server refuses anything under 32 at boot (main run 214). Each run
now generates one with openssl rand -hex 32.

The image job also runs on pull requests (build, hadolint, smoke test)
so a change like this is proven before merge; only main pushes and
deploys. Registry login uses the org REGISTRY_TOKEN: the Gitea job token
is refused by the registry (seen on hittkitchen run 226).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-10-13 14:05:10 -04:00
co-authored by Claude Opus 5.5
parent 168f026e71
commit 771f9871f2
2 changed files with 8 additions and 5 deletions
+7 -4
View File
@@ -76,7 +76,7 @@ jobs:
PYTHONPATH=. .venv/bin/python -m pytest
image:
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
# Builds and smoke-tests on PRs too; only main pushes the result.
needs: [client, lint, nox, server, sidecar]
runs-on: ubuntu-latest
steps:
@@ -98,7 +98,7 @@ jobs:
T=${GITHUB_SHA::8}; C="smoke-caelum-$T-${GITHUB_RUN_ID}"
docker rm -f "$C" >/dev/null 2>&1 || true
docker run -d --name "$C" -e NODE_ENV=production -e DB_KIND=sqlite -e PORT=3002 \
-e JWT_SECRET=ci-smoke-not-a-secret -e CORS_ORIGINS=https://caelum.network "$IMAGE:$T"
-e JWT_SECRET="$(openssl rand -hex 32)" -e CORS_ORIGINS=https://caelum.network "$IMAGE:$T"
ok=0
for i in $(seq 1 24); do
st=$(docker inspect -f '{{.State.Status}}' "$C" 2>/dev/null || echo gone)
@@ -112,8 +112,9 @@ jobs:
docker rm -f "$C" >/dev/null 2>&1 || true
[ "$ok" = 1 ] || { echo "SMOKE TEST FAILED"; exit 1; }
- name: push
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
run: |
printf '%s' "${{ secrets.GITHUB_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin
printf '%s' "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u extant2000git --password-stdin
T=${GITHUB_SHA::8}
for i in 1 2 3; do
docker push "$IMAGE:$T" && docker push "$IMAGE:latest" && docker push "$REDUCE_IMAGE:$T" && docker push "$REDUCE_IMAGE:latest" && break
@@ -122,6 +123,7 @@ jobs:
docker logout "$REGISTRY"
sourcemaps:
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
# Release-based upload: the release must equal what client/src/sentry.js
# stamps on events, caelum@<client package version>. The maps come out of
# the image just built (/app/sourcemaps, outside the served tree).
@@ -154,6 +156,7 @@ jobs:
npx --yes @sentry/cli@2.58.6 sourcemaps upload --release "$RELEASE" --url-prefix "~/assets" smap/assets
deploy:
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
needs: [image]
runs-on: ubuntu-latest
concurrency: deploy-caelum
@@ -171,7 +174,7 @@ jobs:
STAGE="/tmp/caelum-deploy-$GITHUB_SHA"
ssh -o BatchMode=yes "$H" "mkdir -p $STAGE"
scp -o BatchMode=yes deploy/gitea-deploy.sh docker-compose.prod.yaml "$H:$STAGE/"
printf '%s\n%s\n' "${{ gitea.actor }}" "${{ secrets.GITHUB_TOKEN }}" | ssh -o BatchMode=yes "$H" "bash $STAGE/gitea-deploy.sh $GITHUB_SHA $STAGE"
printf '%s\n%s\n' extant2000git "${{ secrets.REGISTRY_TOKEN }}" | ssh -o BatchMode=yes "$H" "bash $STAGE/gitea-deploy.sh $GITHUB_SHA $STAGE"
- name: smoke test (public edge)
run: |
set -eu
+1 -1
View File
@@ -3,7 +3,7 @@
#
# printf '%s\n%s\n' "$REGISTRY_USER" "$REGISTRY_TOKEN" | ssh ovh 'bash /tmp/caelum-deploy-<sha>/gitea-deploy.sh <full sha> /tmp/caelum-deploy-<sha>'
#
# Stdin carries the registry user and the workflow's short-lived job token.
# Stdin carries the registry user and the org REGISTRY_TOKEN.
# They go into a throwaway DOCKER_CONFIG that is deleted on exit, so no
# registry credential stays on the box.
#