Files
fluffy-pancake/AGENTS.md
T

136 lines
7.8 KiB
Markdown

# AGENTS.md — fluffy-pancake
Personal bootc OS image (Fedora base). **This is not an application**: there is no
app entrypoint, no test suite, no package manager of our own. The deliverable is
a container image and an installer ISO built from it.
## Branches (they are NOT interchangeable)
| Branch | Base | Desktop | Targets | Tags |
|---|---|---|---|---|
| `main` | `fedora-kinoite:45` | Plasma | qcow2/raw **and** ISO | `:stable` (+ dated) |
| `feat/umbriel` (this one) | `fedora-bootc:45` minimal | Umbriel + Noctalia Shell v5 + greetd | **ISO only** | `test-<branch>` |
The `Justfile` differs per branch. Do not port `main`'s qcow2/raw targets here.
## Layout
- `Containerfile` — the image. Multi-stage: `FROM scratch AS build-ctx` holds only
`build/`, then numbered package layers, a "config" layer (`COPY` of `configs/`,
`scripts/`), cleanup, and `bootc container lint` as the last line.
- `build/NN-*.sh` — build-time package installs, bind-mounted **one file per layer**
from `build-ctx`. The number is both execution order and cache isolation.
- `configs/` — files copied into the image (systemd drop-ins, skel, greetd,
`containers/policy.json`, `auth.json.template`).
- `scripts/` — helper scripts that land in `/usr/bin` of the image.
- `iso/iso.toml` — Bootc Image Builder ISO config + Anaconda kickstart;
`iso/disk.toml` — filesystem sizing.
- `.gitea/workflows/build-v2.yml` — the only build workflow.
## Commands
```bash
just lint # shellcheck over every *.sh (build/ + scripts/)
just format # shfmt --write over every *.sh
just check # `just --unstable --fmt --check` on Justfile + *.just
just fix # ditto, formatting
just build # podman build of the Containerfile
just rebuild-iso # local podman build -> ISO (needs root/sudo)
just build-iso # pull published image from registry -> ISO
just run-vm-iso # boot the ISO in QEMU (needs /dev/kvm)
just clean # remove output/ and _build* dirs
```
`just lint` ist jetzt grün: Die früheren 5 Findings (`SC2086` in
`build/10-repos.sh` und `build/22-noctalia.sh`, `SC2043` in
`build/23-plymouth.sh`) wurden behoben. `just format` runs shfmt
with default options (tabs) while the scripts are indented with spaces — it will
reindent every script, so don't run it repo-wide unless that reformat is intended.
There is **no test suite**. Verification chain is: `just lint` → container build
(ends in `bootc container lint`) → ISO build → boot the ISO and look at the screen.
Required local binaries: `just`, `podman`, `shellcheck`, `shfmt`. (This sandbox
currently has only `shellcheck`, so builds cannot be run here.)
## Gotchas an agent will otherwise get wrong
1. **`configs/auth.json` is gitignored (secret) but the Containerfile `COPY`s it.**
A bare `podman build` fails at that COPY. `just build`/`just rebuild-iso`
generate a dummy from `configs/auth.json.template`
(`READONLY_TOKEN_PLACEHOLDER`). CI substitutes the real token from secret
`READONLY_AUTH_BASE64`.
2. **`iso/iso.toml` hardcodes `humocs-man.duckdns.org/humocs-man/fluffy-pancake:stable`.**
The Justfile `sed`s exactly that literal to retarget test ISOs. If you change
the registry/image name in the Justfile you must change the literal too —
otherwise a locally built ISO silently installs `:stable` instead of the test image.
3. **ISO builds need rootful podman.** BIB runs `--privileged` and mounts
`/var/lib/containers/storage`; local images are built as `localhost/<image>`
and copied into rootful storage via `podman save`/`load`. `just sudoif` handles
the root/sudo dance.
4. **Package manager is `dnf5`**, never `dnf`/`yum`, always with `-y`.
5. **bootc discards `/var` at deployment.** Anything written to `/var` during the
build is gone on first boot. Seed `/var` via `tmpfiles.d`
(`configs/tmpfiles/`) or a first-boot systemd unit (`configs/flatpak-preinstall.service`).
Only `/etc` and `/usr` survive.
6. **Systemd overrides go to `/usr/lib/systemd/system/<unit>.d/*.conf`**
(vendor drop-in), never `/etc/systemd/system/`. Use `chmod 0644` for the
`*.conf` files — world-writable units make systemd shout in the journal.
Units delivered via `COPY` are not picked up by presets, so `systemctl enable`
them explicitly. **Achtung:** `COPY --chmod=0644 …/<unit>.d/override.conf`
erzeugt das Parent-Verzeichnis selbst mit Modus `0644` (nicht ausfuehrbar),
systemd kann dann die Drop-ins nicht lesen. Nach solchen COPYs explizit
`RUN chmod 0755 /usr/lib/systemd/system/<unit>.d` setzen (gilt analog fuer
andere neu angelegte `.d`-Verzeichnisse wie fontconfig/conf.d).
7. **Keep one concern per `build/NN-*.sh`.** Each is a separate bind mount, so
editing one script busts only that layer. Merging scripts busts the big
download layers.
8. **`configs/skel` only affects newly created users.** Existing systems need
`seed-labwc-skel` (shipped in the image) to migrate; skel changes alone never
reach them.
9. **The build asserts fail fast** (greetd/PAM wiring, `pam_fprintd`, the
`noctalia-greeter-session` wrapper path, plymouth initramfs). These guard
against shipping a broken login screen — fix the cause, don't delete the assert.
10. **Cosign uses the legacy `.sig` format** (`--registry-referrers-mode=legacy`)
because `configs/containers/policy.json` demands `sigstoreSigned`. Switching
to OCI referrers breaks pulls of the image.
11. **The `--build-arg SHA_HEAD_SHORT` passed by the Justfile is not consumed**
(the Containerfile declares no `ARG`) — it does not appear in image metadata.
12. **Fedora 45 moved packaged repo configs to `/usr/share/dnf5/repos.d`.**
dnf5 reads `/etc/yum.repos.d`, `/etc/distro.repos.d` and
`/usr/share/dnf5/repos.d`. RPM Fusion and Terra 45 install their `.repo`
files in the new location, so code that edits or removes repo files must
handle both directories (see `build/10-repos.sh`, `build/21-greetd.sh`).
## CI / publishing
- `.gitea/workflows/build-v2.yml` is **manual only** (`workflow_dispatch`), despite
the README mentioning PR validation — no PR trigger is configured. Add
`pull_request:` to `on:` to enable it (the `pull_request` guards already exist).
- Chain: Buildx → OCI archive tar → `skopeo copy --dest-compress-format zstd:chunked`
→ recursive `cosign sign`. Skopeo is used deliberately to guarantee zstd:chunked.
- Tags: `main` → `stable`, `stable.YYYYMMDD`, `YYYYMMDD`; any other branch →
`test-<branch>` only (no dated variants).
- Secrets: `READONLY_AUTH_BASE64`, `REGISTRY`, `SIGNING_SECRET`, `RENOVATE_TOKEN`.
- Registry cache tag is branch-specific: `buildcache-amd64-main` for `main`,
`buildcache-amd64-<sanitized-branch>` for everything else. The branches use
different base images (Kinoite vs. bootc), so a shared tag would thrash the
cache. `cache-to` uses `image-manifest=true,oci-mediatypes=true` because Gitea
rejects BuildKit's default cache manifest (400 Bad Request) and would
otherwise ignore the cache on pull.
- The registry (`humocs-man.duckdns.org/humocs-man`) is private — pulls need auth.
- Renovate (`renovate.json`) runs nightly at 03:00 UTC via
`.gitea/workflows/renovate_v2.yml`. That workflow intentionally uses
`docker run renovate/renovate` instead of GitHub-hosted actions, because
github.com actions require a GitHub account. Keep it that way.
## Conventions
- Comments and commit messages are in **German**; commits use Conventional Commits
prefixes (`feat:`, `fix:`, `chore:`, `refactor:`). Match that style.
- Shell scripts: `set -eoux pipefail` (build scripts) / `set -euo pipefail` (image
runtime scripts), 4-space indentation, shellcheck-clean for new code.
- The codebase documents *why* extensively, especially for workarounds
(Terra CDN hiccups, PAM auth stacks, bootc `/var` semantics). Preserve that
reasoning in comments when changing these areas.