Files
NODEDC_DEVICE_CORE/docs/CONTINUOUS_DEPLOYMENT.md
T

6.2 KiB

Device Core: deploy from main

Decision, 2026-09-29: a push to SILVER/NODEDC_DEVICE_CORE:main must trigger qualification and automatic deployment after the gates pass. No separate DEPLOY branch or approval for each release. This decision is specific to Device Core; other repositories keep their existing policy until onboarded.

Current implementation status

The source qualification workflow is implemented in .gitea/workflows/ci.yml. It does not deploy. The persistent Synology runner, deployment controller, normal recurring release transition and live end-to-end acceptance are still pending. A green qualification is not a deployment receipt.

Live inspection on 2026-09-29 found Gitea 1.27.2, Device Core Actions disabled and no repo-level runners. The instance-wide runner list was not accessible with the current account (403); no conclusion about global runners is implied.

Host and network

The first runner lives on Synology. No additional listening ports, DSM reverse proxy route, firewall opening or webhook receiver are required. It polls the existing Gitea HTTPS endpoint. Disable the runner cache server and metrics listener initially. Start with one job at a time and an explicit CPU/RAM limit, chosen after reading the live host baseline.

Use container jobs, no host-execution labels, no privileged jobs, no arbitrary host volumes and no Docker socket inside jobs. The runner daemon's own Docker access is privileged infrastructure and belongs to Platform. Repository jobs must not receive production paths, databases, runtime secrets or deploy keys.

Build qualification and production installation are separate responsibilities. A Platform-owned controller polls completed Gitea runs and drives the canonical root-owned nodedc-deploy on the same NAS. It does not expose an HTTP server. The application workflow cannot supply shell commands, target paths or service names to this controller. Adding another repo requires an explicit registry entry, branch policy, release contract and acceptance tests.

Reproduce source qualification

Runner label: nodedc-node22-build; Node 22.21.0, npm 10.9.4, Python >=3.9 and Git must be available in the reviewed build image. The workflow does not download third-party Actions. It fetches the exact pushed SHA from our Gitea. infra/ci/sources.lock.json pins Design Guideline and Platform to full commits; following their current main branches would make old releases unreproducible. Dependencies are fetched into fresh sibling directories. Existing directories are rejected, never reset or deleted by the qualification script.

From a fresh exact Device Core checkout in a disposable parent directory:

python3 infra/ci/qualify.py fetch-dependencies --commit <full-device-core-sha>
python3 infra/ci/qualify.py check --commit <full-device-core-sha> --report ../qualification.json

The checks reject dirty or wrong checkouts and mismatched toolchain versions. They install lockfile dependencies, build the two required Design Guideline packages, run Device Core unit and CI tests, compile the UI and run the existing artifact contract suite against the pinned Platform runner source. The report is created only after all checks pass and records all source SHAs, lockfile hashes and the UI output hash. It contains deployed: false deliberately. The qualification report is evidence, not an authorization token or substitute for independently checking Gitea job identity and the deploy artifact.

Local focused tests: python3 -m unittest discover -s infra/ci -p 'test_*.py'. The full artifact suite belongs on the bounded Linux build worker; there is no requirement to start Docker or run load tests on an operator Mac.

Production activation contract still to implement

  1. Verify the installed runner digest, applied journals, current manager/core release descriptors and preserved runtime state on Synology.
  2. Introduce a versioned normal update transition for repeat releases. Historical recovery descriptors and fixed predecessor guards remain intact. Reusing the v13 manager or v4 core recovery identity is not a CI strategy.
  3. Persist each admitted main revision, run identity and artifact digest in a durable queue. Serialize production transitions. Handle duplicate events idempotently; never install an older revision after a newer one. A missed poll must not lose a push. Do not depend on Gitea job completion order.
  4. Link exact source commits to immutable data-only deploy artifacts. Retain existing manifest.env, files.txt, payload/... validation and fixed component/service selection. Exclude secrets, DB state and executable hooks.
  5. Under the deploy lock, check the current predecessor, obtain and validate a fresh canonical plan, then apply that exact digest automatically. Record commit, run, artifact, plan, receipt and backup. The controller's allowlist is root-owned and cannot be expanded by a workflow artifact.
  6. Before activation verify push success, failed tests, wrong SHA/repo/branch, duplicate events, overlapping pushes, restart recovery and failed-health rollback. Verify that no new host ports or production mounts are exposed.

Build/test failures leave production untouched. Runtime installation failures follow the canonical runner's rollback policy; an ambiguous or failed rollback stops subsequent applies for diagnosis. Never call an unconfirmed release deployed. User/device data and tokens survive application updates.

Operator view

Normal use after activation: push to main, then watch Gitea Actions. Deployment status must separately show the installed commit and receipt. A red check means the candidate did not qualify; it must not show a green deploy. For emergency pause, stop admitting new deployments without cancelling an in-progress apply. Recovery/rollback remains a recorded canonical transition.

Track shared infrastructure in Ops DCPLATFORM-37, root deploy contracts in DCPLATFORM-21, and B2 server/contour integration in MISSIONCOR-86. This deployment mechanism does not mix Device Core and Mission Core inventories.

References: Gitea Actions, runner configuration.