docs(cms-ci): consolidate accepted pipeline and onboarding runbook

This commit is contained in:
DCCONSTRUCTIONS
2026-11-06 00:16:35 +03:00
parent 896b90e888
commit 2a5ba4ca8c
2 changed files with 199 additions and 63 deletions
+79 -63
View File
@@ -1,77 +1,93 @@
# CMS Git deployment domain
Source: SILVER/DC_CMS, repository 33, master. Push → qualification → Gitea artifact → outbound durable queue → canonical installer.
The accepted CMS pipeline is live: `SILVER/DC_CMS`, repository 33, `master` → exact
qualification → Gitea artifact → outbound durable queue → canonical installer.
The accepted application release is r55, source
`5ea737318bc49d23cf90121224e5e4296ab579a5`. Bootstrap 002 and the incident-specific
reconciliation transitions are terminal; do not replay them.
The Device Core runner is scoped only to its own repository. CMS therefore registers its own build-runner in project nodedc-cms-ci, with the accepted Synology v4 resource and isolation profile. Existing Device Core registration, source and units are untouched. Both pinned images must already exist; bootstrap pulls neither. New runner registration is repository-scoped, staged separately from artifacts, imported to root0600 and removed from handoff storage. No credentials appear in Git, receipts or workflow artifacts.
Read [CI_RUNBOOK.md](CI_RUNBOOK.md) before modifying this domain or onboarding
another repository. The living operational card is
[DCPLATFORM-78 — CMS Git CI](https://ops.nodedc.ru/nodedc/browse/DCPLATFORM-78).
[DCPLATFORM-21](https://ops.nodedc.ru/nodedc/browse/DCPLATFORM-21) remains the
mandatory deployment canon; [DCPLATFORM-37](https://ops.nodedc.ru/nodedc/browse/DCPLATFORM-37)
is the shared CI and Device Core reference.
`dc-cms-autodeploy` bootstraps exactly three source files under /volume1/docker/nodedc-cms-autodeploy, one build-runner service and two systemd units. Root-private queue state is /var/lib/nodedc-cms-autodeploy. Its read-only Gitea client uses the existing private Device Core read identity without copying it; preflight checks actual access to repository 33. The installed canonical receipt gates polling. Bootstrap preserves all preexisting containers and CMS data; rollback removes only the new runner/units/source partition, retaining private enrollment and queue for diagnosis.
## Authority and isolation
`dc-cms-release` allows only flat admin/server application files and two exact dependency files. The initial predecessor is original CMS commit 4c6f133 with SMB-verified hashes in baseline.json. Foundation pins adm-zip 0.6.1 in foundation.json to fix known ZIP vulnerabilities. No later dependency, Dockerfile, Compose or Caddy change is admitted by this domain. Build uses the registered Dockerfile in an isolated temporary context with an empty projects directory. Only the temporary FROM line is replaced by the exact cached Node image ID proved against the accepted application's layer ancestry and inherited configuration; see [the build-base contract](R40_BUILD_BASE.md). The canonical installer restarts only cms-app with no dependencies, no image pull and no rebuild during rollback. Acceptance verifies authentication, app hashes inside the running container, image generation, fixed ZIP dependency version, preserved env/mounts/networks/ports, other Compose services and site/project data.
CMS has its own repository-scoped `synology-cms-build` registration, controller,
SQLite queue and systemd service/timer. Registration identity is read from the
verified root-private record; it is not copied from Device Core. Its read client
uses the existing private read identity with access to repository 33. Enrollment,
application secrets and site workspaces never enter Git or release artifacts.
The daemon has the reviewed Synology CPUSet/memory isolation profile; job containers
have no Docker socket, production credentials or arbitrary host volumes.
## Build and checks
Only the installed root-owned `/usr/local/sbin/nodedc-deploy` executes production
transitions. Source/controller modules are embedded deterministically, never
imported from writable SMB at runtime. A new application cannot choose roots,
services, Compose context, build commands or acceptance through its manifest.
`python3 infra/cms-deploy/embed_runtime.py` refreshes only the explicitly marked standalone section. Registry and dispatcher wiring are ordinary reviewed runner source. Runtime never imports the fragment files from SMB.
## Application release contract
`python3 -m unittest discover -s infra/cms-deploy -p 'test_*.py'`
`python3 -m unittest discover -s infra/deploy-runner -p 'test_device_core_*.py'`
`python3 infra/cms-deploy/build_autodeploy.py --output-dir <directory>`
`dc-cms-release` accepts only registered flat `admin`/`server` application files,
the exact two dependency files and `server/cms-release.json`. Runtime dependencies,
Dockerfile and Compose changes require a separate reviewed foundation transition.
The initial foundation pins `adm-zip` 0.6.1. UI build dependencies are separate;
qualification verifies the committed UI assets against the frozen package build.
Before production: SHA-pinned root runner promotion and verify-install; then fresh canonical plan/apply of the bootstrap artifact. Ordinary CMS pushes afterward need no operator NAS commands. A queued or green Actions run alone is not deployment evidence; require canonical receipt and product acceptance.
The clean temporary build context has an empty `projects` directory. The inherited
Node base must match accepted image ancestry and full configuration. A registered
immutable base can be restored only after exact proof; plan never pulls. Build
uses a proved local image ID and preserves Compose-owned labels. See
[R41_NODE_BASE_ACQUISITION.md](R41_NODE_BASE_ACQUISITION.md) for exact digests and limits.
The source Dockerfile is not rewritten. Application recreation selects only
`cms-app`, with fixed Compose/env/project, `--no-deps` and no implicit pull.
Rollback restores the prior image without rebuilding it.
Bootstrap 002 corrects the initial POSIX inventory: the NAS contains a Synology
`server/@eaDir/admin-server.mjs@SynoEAStream` file hidden from SMB. The original
application and foundation hashes were confirmed unchanged through both paths.
Only flat `admin|server/@eaDir/<present-application-file>@SynoEAStream` regular
files are classified as metadata. Orphaned streams, unknown paths and symlinks
remain errors. Metadata is excluded from application identity and clean image
build inputs, and preserved byte-for-byte across application release/rollback.
The same partition handles old images containing these non-code streams; all
application hashes are still exact. Bootstrap 001 failed during read-only plan,
never entered apply, and is superseded rather than retried or overwritten.
Acceptance checks authentication/health, exact running application bytes,
image/generation, env/mounts/network/ports, other services and site/project data.
CMS fingerprint v2 normalizes only validated bind ordering and explicitly empty
DNS representations. Synology metadata is classified narrowly and preserved;
unknown paths, orphan streams and symlinks are rejected.
After bootstrap 002 was accepted, Gitea assigned CMS runner ID 2. The initial
copied source verifier still required Device Core's ID 1 and rejected successful
run 39 before staging or deployment. Qualification now receives the ID from the
root-private CMS `data/.runner` registration; it verifies exact runner name,
repository, labels, job, steps, run identity and artifact ownership. Registration
IDs are allocated by Gitea, so no fixed numeric fallback is permitted. This
controller correction preserves the accepted bootstrap 002 receipt and private
queue; it does not rerun bootstrap or re-register/restart the build daemon.
## Qualification and verification
Release r39 then reached canonical apply but failed runtime-config acceptance;
its automatic rollback restored the original source and healthy authenticated
CMS, while full runtime equivalence remained unproven. The failed receipt and
controller reconciliation barrier stay intact. `dc-cms-runtime-audit` is a
separate **plan-only** diagnostic domain pinned to that exact incident, archive
and six backup-file hashes. It reads current source/data/image/runtime evidence
and reports a bounded saved-digest preimage search without accepting any drift.
No environment values or raw Docker inspection are printed. `apply` is forbidden;
no application, queue, receipt or service is changed by this audit. Recovery must
be a separately reviewed transition after its actual runtime findings.
CMS owns `.gitea/workflows/ci.yml` and `infra/ci/release.py`. Only successful exact
`push` runs on `master` are admitted; workflow dispatch is not a production trigger.
The controller checks repository/run/attempt/source/job/steps/registered runner,
artifact ownership/digest and installed → candidate → current-branch ancestry.
Its durable queue reconciles canonical receipts after interruption and blocks on
uncertain rollback. No manual NAS command is needed for an ordinary qualified push.
After diagnostic runner promotion, build its fixed data bundle with
`python3 infra/cms-deploy/build_runtime_audit.py --output-dir <directory>` and
use only the canonical `plan` operation for the audit artifact.
For changes to deployment policy:
The r39 audit confirmed the old image and all source/data/dependency checks.
Offline reconstruction matched the complete current fingerprint and the complete
saved predecessor fingerprint: only bind-string order and three empty DNS list
representations differ. See [the incident proof and recovery contract](R39_RUNTIME_RECONCILIATION.md).
The separate `dc-cms-runtime-reconciliation` marker transition re-proves that
exact legacy hash on NAS before releasing the r39 barrier. It never retries r39.
Reconciliation was accepted at 2026-11-04T20:28:35Z. The next qualified run r40
failed only `config.Env`; its automatic rollback passed completely. r40 is also
terminal and must not be replayed. The new r41 commit qualified and staged,
but the original global image lookup was rejected during preflight. The
[scoped discovery correction](R41_BASE_DISCOVERY.md) follows CMS image ancestry,
with a bounded Node-only cache fallback and safe public error codes. After
runner promotion the controller may resume staged r41 with a fresh plan;
no bootstrap or failed-release replay is needed.
The scoped runner was installed; its preflight reported no matching base.
The [Compose-label correction](R41_COMPOSE_LABELS.md) accounts for the three
labels added by Compose, reproduces them during build, and retains exact
post-build configuration comparison. That runner was installed; all five local
Node candidates still failed the filesystem-prefix check. The
[registered base-acquisition policy](R41_NODE_BASE_ACQUISITION.md) can restore
one pinned public Node base only after exact preflight ancestry/config proof.
Deployment is pending promotion of that policy and actual NAS acceptance.
```sh
python3 infra/cms-deploy/embed_runtime.py
python3 -m unittest discover -s infra/cms-deploy -p 'test_*.py'
python3 -m unittest discover -s infra/deploy-runner -p 'test_device_core_*.py'
```
Embedding is needed only after source changes to the embedded modules. Also check
Python 3.8 grammar, deterministic artifact bytes, negative authority/rollback cases
and the real Compose/runtime path. Documentation-only updates do not promote or
install a runner. Existing source commits, artifacts and acceptance evidence are
listed in the runbook; a green CI run alone is not production deployment evidence.
## Failure contracts
- [R39 runtime proof](R39_RUNTIME_RECONCILIATION.md): exact bind/DNS reconciliation,
no runtime mutation, immutable failed receipt.
- [R40 base drift](R40_BUILD_BASE.md): mutable tag changed inherited image state;
strict rollback remained intact.
- [R41 scoped discovery](R41_BASE_DISCOVERY.md): bounded ancestry/cache lookup,
no broad Docker inventory assumptions.
- [R41 Compose labels](R41_COMPOSE_LABELS.md): reproduced Compose additions are
preserved; this alone did not prove a matching NAS filesystem base.
- [R41 registered acquisition](R41_NODE_BASE_ACQUISITION.md): one exact public base,
full ancestry/config proof, then successful application installation.
These documents preserve the conditions and limitations of the investigated cases.
Their intermediate pending states are not current operational status. Use the
runbook and fresh canonical receipts for current state. CMS content publication
and portable site backups are separate product flows documented in DC-9.