Menu
AkurAI-Build
publicLatest change fab22f173067842a9635889fa6c4c63436e6bd6f - Deploy job hands off to the host agent and exits before the restart by Ólafur Búi Ólafsson
#!/bin/sh
# Stage the freshly packaged akurai binary for the host deploy agent.
#
# CI jobs run inside the hardened akurai-build service (ProtectHome=read-only,
# NoNewPrivileges), so they cannot swap the service binary or restart the unit
# themselves — and they cannot outlive the restart either, because the worker
# executing this job runs inside the very service being replaced. This job
# therefore hands off and exits: it stages the candidate plus its sha256 into
# the service data dir and the root-owned akurai-deploy.path unit (deploy/host/)
# verifies the checksum, installs, restarts, health-gates, and rolls back to
# the previous binary automatically if the service does not come up.
set -eu
staging="${AKURAI_DEPLOY_STAGING:-/home/olibuijr/.local/share/akurai-build/deploy-staging}"
test -x target/release/akurai
mkdir -p "$staging"
rm -f "$staging/result"
install -m 755 target/release/akurai "$staging/akurai.next"
sha256sum "$staging/akurai.next" | cut -d' ' -f1 > "$staging/request.tmp"
mv "$staging/request.tmp" "$staging/request"
printf '%s\n' "candidate staged; host agent will verify, install, restart, and health-gate with rollback"
exit 0