ci: build and publish the evie image to the Forgejo registry on main #88
No reviewers
Labels
No labels
epic
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fm/evie-ci-image-publish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CI now builds
packages.eviedaemonImageon every push tomainand publishes it to theprivate Forgejo container registry;
deploy/docker/pulls that image instead of assuming alocal
nix build..forgejo/workflows/ci.yml: newpublishjob (needs: check).flake.nix:devShells.publish(skopeo only), so the push tool is pinned byflake.lockrather than by whatever the runner's flake registry resolves to.
deploy/docker/docker-compose.yaml:image: forge.weiwen.dev/weiwen/evie:latest.deploy/docker/README.md,docs/deploy-docker-migration.md: the flow is nowdocker login forge.weiwen.devonce, thendocker compose pull && docker compose up -d.CONTEXT.md,AGENTS.md: pointers, no duplicated detail.⚠️ Needs one Actions secret before it can publish
The automatic Actions token cannot write packages on this instance. The first CI run on
this PR measured it:
POST /v2/weiwen/evie/blobs/uploads/as${{ github.repository_owner }}with
${{ github.token }}→ HTTP 401 (Forgejo 15.0.6, matching Forgejo issues #1296 /#3571). So this needs:
Nothing is hardcoded and no credential was invented. The job reads
REGISTRY_TOKENand doesnot fall back to
github.token— a fallback to a credential now known to 401 would onlyconvert "missing secret" into a confusing auth error. With the secret absent, the credential
check fails fast with exactly the instruction above; that is why
CI / publishis red onthis PR. It goes green once the secret exists, with no code change.
Tags
forge.weiwen.dev/weiwen/evie:<12-char short sha>is pushed from the stream, then:latestis a registry-side copy of it (blobs already uploaded, so it is a manifest write and takes
seconds). Deploys can pin to the short sha;
:latestalways means the tip ofmain. Versiontags are not wired up:
ci.ymltriggers onmainonly, and addingtags: ['v*']wouldalso drag the
checkjob onto tag pushes for no benefit today.Why the
nativerunner, not theubuntu-latestcontainercheckusesThe
matsutakerunner offers both labels (ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-latestand
native:host).publishtakesnative:nix build .#eviedaemonImagecompletes in 19 s there. In a throwaway container it is a multi-GBsubstitution on every push, and
cache-nix-actionis configured withgc-max-store-size-linux: 1G, so it cannot hold that closure.nix.confcarries the extra substituters that servepi(cache.numtide.com).A container provisioned by
install-nix-actiondoes not, so those paths risk beingbuilt from source rather than fetched.
push mechanism below.
checkis untouched and stays onubuntu-latest.Why skopeo, not
docker load+docker pusheviedaemonImageis astreamLayeredImage: a script that writes a docker-archive tarball tostdout. skopeo reads it straight off the pipe, so nothing multi-GB is staged on disk and no
daemon is involved:
docker load+docker pushwas not an option anyway (no daemon on the runner), and itwould also mean writing 4.9 GB into a daemon's storage first.
--dest-compressgzips thelayers on the way up: 4.9 GB of archive becomes ~1.67 GB pushed, as a
manifest.v2+jsonwith
...rootfs.diff.tar.gziplayers — exactly whatdocker compose pullwants.Proven vs. unverified-until-merge
Proven in CI (this PR's run, on the real
nativerunner):nativelabel works for this repo, which no workflow used before:Set up jobandactions/checkout@v7both succeeded in host mode under theforgejo-runneruser.finding above, and it left no package behind.
CI / checkstill green (2 m 12 s), unaffected.Proven by hand on
matsutake(the same host and nix store thenativerunner uses):nix build .#eviedaemonImage— 19 s warm; the stream is 4.9 GB, 83 s to generate.stream | skopeo copy --dest-compress docker-archive:/dev/stdin docker://forge.weiwen.dev/...— 2 m 09 s, 1.67 GB / 96 gzip layers,manifest.v2+json,verified with
skopeo inspect --raw.:latestregistry-side copy — 3.9 s.nix develop .#publish -c skopeo, includingREGISTRY_AUTH_FILEpass-through into the devshell and
skopeo login --password-stdin.token (202 then 204), the unset-secret error, and a 401 with a bad token.
weiwen/evie-ci-probe) that was deleted; theweiwencontainer package list is back to empty, so the first real image comes from CI.just checkgreen (490 tests), workflow YAML parses, everyrun:block passesbash -nand
shellcheck, compose YAML parses.Unverified until the first push to
mainafter this merges:but the
Publishstep is skipped on pull requests (if: github.event_name == 'push'), sothe first real proof that
:latestand:<sha>land in the registry is that firstmainrun. Do not deploy off
:latestbefore it is green.nix buildon thenativerunner (asforgejo-runner, against thehost store and daemon). The credential check fails ahead of it, so that step has not yet
run there — it is only proven as
weiwenon the same host.1bb716a8d6e5b6d47ef2