Import CI enrollment into private NAS runtime during bootstrap

This commit is contained in:
Codex
2026-09-29 14:17:25 +03:00
parent f775929093
commit aa84e73bd8
6 changed files with 355 additions and 28 deletions
+22 -6
View File
@@ -32,12 +32,28 @@ been accepted. Later repositories receive explicit registrations/policies.
Use the authenticated Gitea API to obtain the Device Core repository runner
registration token. Do not copy a personal Git token into the runner.
Prepare `/volume1/docker/nodedc-deploy/runtime/gitea-ci/enrollment.pending.json`
as a private regular single-link file (mode 0600), containing only the exact
Stage `/volume1/docker/nodedc-deploy/runtime/gitea-ci/enrollment.pending.json`
through the operator's authenticated SMB session, containing only the exact
repository identity and its registration token. Never put this file in Git,
inbox, artifact payload, logs, Ops text or chat. The canonical runner imports
the token into a root-owned runtime file and mounts it readonly. Gitea creates
the persistent `/data/.runner` identity on first start. Its content is secret.
inbox, artifact payload, logs, Ops text or chat. This is a temporary handoff,
not the runtime secret. The NAS owner must be `dctouch` or root. The v2
preflight opens it with `O_NOFOLLOW`, rejects symlinks/hardlinks/special files,
limits the input to 2048 bytes, validates its schema and checks for concurrent
changes. Plan reports only safe filesystem metadata and does not change rights.
On 2026-09-29 the first v1 plan rejected this file's NAS metadata even though
the Mac SMB mount displayed 0700/regular/nlink1. A Mac `chmod 600` and a
successful Mac stat are not proof of the actual NAS permissions. V1's strict
private-file check is retained; use the explicit v2 import transition for SMB.
V2 apply creates the private file on NAS as root: `secrets/registration-token`
is 0600, its directory is 0700. Publication is atomic without overwriting an
existing identity, file and directory entries are fsynced, then the private
copy is revalidated. Only after that is the staging input removed. A mismatch
with an existing private copy is rejected. An interrupted apply can reuse the
same verified private copy after the canonical failure/retry review. Gitea
creates the persistent `/data/.runner` identity on first start. Neither private
file is part of the artifact, source backup, journal or diagnostic output.
The bootstrap accepts no existing installed CI descriptor or CI container.
Preflight also checks at least 8 GiB free disk and 3 GiB currently available
@@ -50,7 +66,7 @@ From a clean Platform commit:
```sh
python3 -m unittest discover -s infra/gitea-ci -p 'test_*.py'
python3 infra/gitea-ci/build_artifact.py --patch-id gitea-ci-bootstrap-v1-<unique-id> --source-commit <full-sha> --output-dir <output-dir>
python3 infra/gitea-ci/build_artifact.py --patch-id gitea-ci-bootstrap-v2-<unique-id> --source-commit <full-sha> --output-dir <output-dir>
```
The first use requires promotion of the reviewed root runner through the