- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| docs | ||
| modules | ||
| .gitignore | ||
| .gitmodules | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| initialise_modules.sh | ||
| README.md | ||
| SETUP.md | ||
| setup.sh | ||
| update.sh | ||
ai-images
The container images in which the stages of the development process run. The
runner stage-run.sh in wulf-dev starts each stage (requirements, design,
tests, code, audit) in a fresh rootless Podman container from one of these
images and mounts only that stage's inputs. This repo builds those images and
publishes them to the container registry of this repository on the git system.
It builds nothing else.
Effort level: tool.
What to build
Build the images with apko (and melange for any package that Wolfi does
not have), the same way the ci-tools repo builds its CI image, and run the
build in the ci-tools image: in the CI workflow of this repo and, locally,
with docker run of that image. Do not build with Docker or Podman build files;
there is no Containerfile and no Dockerfile in this repo.
Image 1: base
The first and, for now, only image. Every stage of wulf-dev uses it.
It must contain:
| What | Why |
|---|---|
A POSIX shell at /bin/sh |
The runner's own command in the container is a script for /bin/sh. |
git |
The runner runs git init -q before the stage's command; stages that use Doorstop need a repository. |
bash, jq, yq (the Go one, mikefarah) |
The issue scripts and their tests use them. |
coreutils and busybox (so id, sleep, true, ls, touch, printf, wget) |
The tests of the runner run small commands in the container. |
Keep it minimal. Add nothing else without a reason written down in the commit.
Doorstop, static-check tools and agents are not part of base; they come
later (see "Later").
How the runner starts a container (what the image must survive)
The image is used with exactly these conditions, so the build must be checked against them:
- Rootless, as an arbitrary non-root user with no entry in
/etc/passwd(--userns=keep-id). Tools must work without a home folder, a user name or a writable$HOMEother than the one the runner sets (HOME=/home/stage, a temporary filesystem). - Read-only root filesystem. Only
/tmp,/var/tmp,/run,/dev/shm,/projectand/home/stageare writable (temporary filesystems). Nothing may need to write anywhere else. - No network. Nothing at run time may need it.
- The runner sets the entry point (
/bin/sh), the working folder (/project) and the user. So the image has noUSER,ENTRYPOINT,CMDorWORKDIR. /projectis a mount point the runner creates on a temporary filesystem; the image must not hold files there.- No credentials, keys or tokens in any layer.
Properties of every image
- Reproducible and pinned. Use an apko lock file for the package versions
and commit it. Rebuild only when an input changes (the fingerprint and stamp
approach of
ci-tools). - Two architectures:
amd64andarm64(the developer's machine is arm64, CI is amd64). Push one image per architecture, then a manifest, thenlatest, asci-tools/create-and-publish.shdoes. - An SBOM per architecture, as
ci-toolsdoes. - Consumed by digest. A project names the image in its
stages.yaml. The publish step must print the digest of the manifest so that the owner can pin it. - Annotations as in
ci-tools/apko/ci-tools.in.yaml(name, version, authors, source, licenses, vendor, title, description), with the values of this repo.
Where the images go and how they are named
- Registry: the one of this repository on the git system.
REPOandVERcome from a local.env(never committed), as inci-tools. - Reference:
${REPO}/base:${VER}and${REPO}/base:latest. (Open: the owner confirms the exact registry path at the first publish.) - Credentials for the registry come from
.envor the CI secrets and are never printed, logged or written to any file.
How to check an image
Before publishing, check the built base image against the conditions above with
the real thing. After docker load or podman load of the tarball, with
IMAGE as its name:
podman run --rm --pull=never --read-only --network=none --user 12345:12345 \
--mount=type=tmpfs,destination=/tmp --env=HOME=/tmp "$IMAGE" /bin/sh -c '
git --version && bash --version | head -1 && jq --version && yq --version &&
id && sleep 0 && /bin/true && git init -q /tmp/r && echo ok'
It must print ok and exit 0. Put such a check in this repo as a script and run
it in CI before the push. The consumer's own tests are the final check: the
wulf-dev runner tests start real containers from the image the owner names and
skip when it is absent.
Later (not now)
- Images per agent (an agent such as Claude Code or opencode must be inside the
image, because the adapter's command runs there):
baseplus the agent. - Doorstop and the static-check tools of the code stage.
- Per stage images, only if a stage needs a tool the others must not have.
Each of these is added by its own phase with its own roadmap.
How to work in this repo
Follow AGENTS.md: roadmap phases, one PR per part, no commits to main,
the stages in order. The first phase is "base image": write
docs/roadmap/phase-1-base-image.md first, with a checklist that has one item
per stage (design, tests, code, audit) as AGENTS.md requires. The tests of
this repo check the built image (the section above), not the apko files.
Repository setup
(From the repository template; run once per clone.)
New repo setup
1. Commit signing (SSH, hardware security key)
Every commit and tag must be signed with the SSH security key
(id_ed25519_sk_g.wulf.pub). This is local, per-repo git config — it
does not carry over from other repos, even ones on the same machine, and
a freshly created repo will otherwise silently fall back to old-style GPG
signing and fail with something like:
error: gpg failed to sign the data
gpg: skipped "...": No secret key
Fix, run once per new repo clone:
git config gpg.format ssh
git config user.signingkey ~/.ssh/id_ed25519_sk_g.wulf.pub
git config commit.gpgsign true
git config tag.gpgsign true
# Repo-local allowed_signers file — also does not carry over between repos,
# since it lives inside .git/. Build it from the key + this repo's configured
# email (check `git config user.email` is the one you actually want first —
# it may have inherited a personal default rather than the work one).
printf '%s %s\n' "$(git config user.email)" "$(awk '{print $1, $2}' ~/.ssh/id_ed25519_sk_g.wulf.pub)" > .git/allowed_signers
git config gpg.ssh.allowedSignersFile .git/allowed_signers
Verify without creating a real commit (a dangling commit-tree object isn't
referenced by any ref, so it never shows up in log/status and needs no
cleanup):
TREE=$(git write-tree)
TEST_COMMIT=$(git commit-tree -S -m "test signing" "$TREE")
git log -1 --show-signature "$TEST_COMMIT"
If that fails with agent refused operation, the OS's built-in ssh-agent
often can't relay the touch/PIN prompt for security-key (sk-) identities
properly. Clear it and let git talk to the on-disk key handle directly:
ssh-add -D
Then retry the commit-tree check above.
2. Fetch submodules, then bootstrap
Do step 1 first — setup.sh verifies signing as its last step. Then, from the
repo root:
bash initialise_modules.sh # initialise submodules due to bug in Forgejo.
bash update.sh # fetch submodules (wulf-dev + scripts)
bash setup.sh # install hooks + verify signing
update.sh fetches the wulf-dev submodule at modules/wulf-dev, which
provides the git hooks and helper scripts (pr.sh, issue-new.sh,
issue-validate.sh) — no copies live in this repo. setup.sh then:
- installs the hooks (
core.hooksPath=modules/wulf-dev/hooks:pre-commitblocks direct commits tomain,pre-pushrejects any unsigned commit); - verifies your commit signing works (this prompts for your security key).
setup.sh is idempotent — re-run it any time. docs/roadmap and docs/reviews
already ship with the template. Re-run bash update.sh later to advance the
submodules to the latest tooling.
3. Forgejo credentials for local scripts (.env)
modules/wulf-dev/scripts/pr.sh needs a .env (already gitignored) with:
FORGEJO_TOKEN=...
FORGEJO_URL=https://forgejo.wulf.science
FORGEJO_OWNER=...
FORGEJO_REPO=...
This is a local-dev-only credential — it has nothing to do with what CI uses
(see below). The milestone/issue-sync logic itself doesn't live in this repo
at all; it's the shared ci-actions actions the workflows in .forgejo/workflows/
call.
4. CI secrets and variables
Scope these at the right level, or you'll be resetting them per-repo forever. Forgejo has three levels — repo, organization, and user — and it's easy to pick the wrong one:
- User-level secrets/variables (
/user/settings/actions/secrets) only apply to repos owned by that user's personal namespace. Setting something on theci@wulf.scienceaccount does not make it available toWulfScience/WulfScience-FOSS-owned repos, even though that account is used as the committer identity inside their workflows — ownership and identity are different things here. - Organization-level (
Organization Settings → Actions → Secrets/Variableson whichever org owns the repo) applies to every repo in that org. This is the right place for anything identical across repos — which is everything below. - Repo-level overrides the org-level value for that one repo specifically, if some repo genuinely needs a different value.
What's actually needed:
| Name | Level | Notes |
|---|---|---|
CI_TOOLS_IMAGE / CI_TOOLS_IMAGE_TAG |
org (or repo) | The container image workflows run in. |
FORGEJO_TOKEN |
— | Don't set this as a stored secret. Forgejo Actions injects a scoped, one-time token per job automatically; the workflows reference secrets.FORGEJO_TOKEN expecting that auto-injected value, not something you create. |
ISSUE_INTAKE_SSH_KEY |
org | Only needed if using the issue-intake action. SSH private key with push access, used to push the intake branch. Keep it a separate key from the signing key below — see AGENTS.md's reasoning if you want the full "why not just one key" answer, short version: a partial leak of one shouldn't grant both push and signing capability. |
ISSUE_INTAKE_SIGNING_SSH_KEY |
org | Separate SSH private key, used only to sign the intake commit. Its public half needs registering on the ci@wulf.science Forgejo account as a verified signing key. |
ISSUE_INTAKE_PR_TOKEN |
org | A Forgejo access token on ci@wulf.science, scope repository: write (that's the scope that covers PR creation — there's no finer-grained "create but can't merge" scope available, so this token is technically capable of merging even though it's only meant for creation; see below for the actual enforcement). |
ci@wulf.science's team permissions on any repo using issue-intake:
Code, Issues, Pull Requests — all Write. Nothing else (no Releases, Wiki,
Projects, Packages, or Actions access needed — none of the sync logic touches
those).
Branch protection on main — since ISSUE_INTAKE_PR_TOKEN's scope can't
be restricted to "create-only," the actual "no merge rights" guarantee has to
come from branch protection, not the token. Two independent settings matter:
- Require signed commits — otherwise this is only enforced by the local
pre-pushhook, which doesn't run for CI-originated pushes/merges at all. - Merge whitelist (not "required approvals," which adds a click to every
solo PR even when there's no one else to review) — restrict merge rights to
an Owners/maintainers team that
ci@wulf.scienceis deliberately not a member of, so it can open the intake PR but cannot merge it regardless of what its token could technically do.