Co-authored-by: Arnaud Dartois <admin@tordais.cc>
7.9 KiB
name, description
| name | description |
|---|---|
| heimdall-agent-update-acceptance | Validate Heimdall native Agent install, signed update, startup health, and rollback behavior. |
Native Agent update acceptance
Use this skill when changing install/install-agent.sh, install/install-agent.ps1, install/agent-supervisor.py, or install/agent-update-supervisor.ps1.
For Docker Agent install/update changes, also inspect the generated Compose and
docker run commands in SiteInstallPanel.razor, plus both CPU and NVIDIA
Agent images. The Docker updater shells out to the Docker CLI and therefore
requires the CLI in the image and /var/run/docker.sock mounted into the
container. Validate the generated Compose and Docker-run command together;
document that mounting this socket grants broad control of the host. The Docker
Run panel must provide POSIX and PowerShell commands, use an immutable signed
image reference, initialize the state volume, and keep the health endpoint
reachable for update rollback checks. A disposable image acceptance should
build with a project-unique tag and assert docker --version inside the image,
then remove and verify absence of that exact tag. When Compose has multiple
services using the built Agent image, the acceptance override must retag every
service, including one-shot volume initialization, so it does not create an
untracked :local image.
For Windows Service installation, set MODEL_PATH to the installed
current\models\yolov8n.onnx path because the Service Control Manager does not
start services from the Agent release directory. Validate the service's model
path, enrollment, startup, signed update, and rollback on a real Windows host;
PowerShell parsing on Linux is not a substitute for that run.
For Linux systemd installs, preserve the site display name through the existing
LoadCredential=agent-name credential and AgentOptions fallback. The
foreground installer may pass Agent__AgentName directly; do not put arbitrary
site names in an unescaped systemd Environment= assignment.
Linux enrollment values must be passed to install/install-agent.sh using
--central-url-file and --site-token-file, each pointing to a regular file
with no group/other permissions. Reject legacy --central-url and
--site-token values because they are visible in process listings. The site
token is persisted only in root-owned and Agent-owned mode-0600 credential
files and loaded by systemd LoadCredential; generated command text must not
contain either enrollment value. Keep the temporary prompt files mode 0600 in
a mode-0700 directory and remove them on every exit path. Verify generated
Linux command text has no Central URL or site token, both legacy value flags
fail before installation, and unsafe/symlink/empty files are rejected.
Keep the Central URL out of process arguments and unit contents. The Linux
installer stores it in the Agent release's appsettings.json with mode 0640
inside the mode-0750 Agent release tree; a new Agent may alternatively load it
from a systemd central-url credential through CREDENTIALS_DIRECTORY.
Agent logs must not include the Central URL.
The server installer Compose project/network must use Compose's project-scoped
resource names rather than fixed global name: values. The interactive
installer should default CORS to the configured public HTTPS origin when one
is supplied and otherwise use a restrictive placeholder that the operator
must replace; do not default a new installation to wildcard CORS.
Before accepting a native or Docker install flow, verify that Central's global
updates.forgepublicurl contains only the HTTPS public Forgejo origin and that
Central constructs api/v1/repos/arnaud.dartois/Heimdall/releases/latest from
it. The calculated API URL is read-only in Settings. A published release must
contain the signed manifest, asset checksums, and required image digest. A
main Docker image build alone cannot supply the signed Agent release metadata
used by installers and the IHM.
Forgejo releases may omit the optional asset.digest API field. In that case,
Central may fetch the public key, manifest, and signature only from HTTPS URLs
on the configured Forgejo origin, then must verify the ECDSA P-256 signature,
release tag, manifest schema, archive SHA-256 values, and image digests before
returning metadata. Use the hashes from the verified signed manifest for
downloadable archives. Reject cross-origin asset URLs, redirects to another
origin, bad signatures, malformed digests, and tag mismatches. Do not replace
missing API digests with unchecked archive metadata or disable verification.
Validate both an actual release whose API omits asset.digest and synthetic
tampered metadata in a source-built Compose acceptance.
Linux rollback simulation
- Run
python3 -m unittest discover -s scripts/ci -p 'test_*.py' -k supervisor_rolls_back_failed_startup_to_previous_release. - The test creates two synthetic release directories and a
currentlink to the candidate, writes a pending-update marker, and injects a fakedotnetexecutable that exits immediately with failure. - Verify the supervisor returns 75, atomically points
currentback at the prior release, removespending-update.json, and reports that the previous release was restored. The fixture must live inTemporaryDirectoryand leave no files behind. - This covers only the startup-failure rollback branch. It does not validate HTTP update discovery, signed archive verification, a 60-second healthy startup window, systemd, Windows service behavior, or a real Agent host.
Local and host acceptance boundary
- Keep
HEIMDALL_SOURCE_BASE_URLlimited to Heimdall-owned installer assets; vendor runtimes and dependencies must use their official distribution channels. - For updates, exercise both successful and rejected signatures before installation. Preserve the previous release until the candidate has reported the expected version and stayed healthy for the configured stability interval.
- Use a temporary install root and fake runtime for local failure/rollback tests. Never point these tests at
/usr/local, a real systemd service, production credentials, or an installed Agent state directory. - Report Linux and Windows real-host install/update/rollback as open until each OS has been exercised with a real service and the expected signing configuration.
- The Linux installer retries the release metadata request at most three times for transport failures, HTTP 408/425/429, and HTTP 5xx, with 2s then 4s waits. Other HTTP statuses fail immediately. Acceptance should verify transient-then-success, persistent-5xx bounded failure, permanent-4xx no-retry behavior, and that release signature and archive digest checks remain required.
Central installer asset delivery
Heimdall.Web.csprojpublishes the Linux/Windows Agent installers and their supervisors underwwwroot/install/;Program.ConfigureMiddlewareserves them through ASP.NET Core static files.- ASP.NET Core's default MIME table does not recognize
.py. Add.pyto aFileExtensionContentTypeProviderexplicitly or/install/agent-supervisor.pyreturns 404 despite being present inwwwroot. - For changes to these assets or static-file configuration, build Central from the current source in a disposable Compose project and GET
/install/install-agent.shand/install/agent-supervisor.py. Require HTTP 200 and byte-for-byte equality with their source files. Also require/healthzhealthy. - Follow
skills/compose-disposable-recipe/SKILL.md: use generated credentials, isolated ports/project volumes/network, a unique Central image tag, and an EXIT trap installed before build. Verify all project containers, volumes, and networks are gone and remove/verify absence of the exact local image tag. Keep shared base images. - A successful local acceptance proves the source-built Central serves the files; it does not prove a deployed Central image has been rebuilt or restarted. Confirm deployed endpoints separately before calling an incident resolved.