Install node for host-mode JavaScript actions

In host mode the runner runs actions/checkout and friends with the
host's node, and stpbuild had none: salary-insights' first run there
failed with 'Cannot find: node in PATH'. RUNNER_NODE_VERSION in a host
file installs that release from nodejs.org (sha256 from SHASUMS256.txt)
as /usr/local/bin/node. stpbuild pins Node 24, the actions' runtime;
Renovate bumps it within the major.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-27 13:50:07 +00:00
co-authored by Claude Opus 5.5
parent 04a447813c
commit 27260ee85e
4 changed files with 47 additions and 1 deletions
+6 -1
View File
@@ -30,7 +30,12 @@ registration turns it into `/var/lib/gitea-runner/.runner`, which is the
lasting credential. Gitea's runner list then shows the new runner. lasting credential. Gitea's runner list then shows the new runner.
The VM needs `curl`, `git` and, for container or host jobs that use it, The VM needs `curl`, `git` and, for container or host jobs that use it,
Docker with `RUNNER_USER` in the `docker` group. A VM without Tailscale can Docker with `RUNNER_USER` in the `docker` group. Host-mode jobs that use
JavaScript actions (`actions/checkout`, `actions/setup-node`, …) also need
`node` on the host, or they fail with `Cannot find: node in PATH`: set
`RUNNER_NODE_VERSION` in the host file and `install.sh` puts that release at
`/usr/local/bin/node` (only `node`; jobs get their own Node from
`actions/setup-node`). A VM without Tailscale can
still be set up from the Proxmox host: `qm guest exec <vmid> -- bash -c '...'`. still be set up from the Proxmox host: `qm guest exec <vmid> -- bash -c '...'`.
## Upgrading ## Upgrading
+2
View File
@@ -6,3 +6,5 @@ RUNNER_NAME=stpbuild-runner
RUNNER_USER=adamf RUNNER_USER=adamf
RUNNER_CAPACITY=2 RUNNER_CAPACITY=2
RUNNER_LABELS="build:host" RUNNER_LABELS="build:host"
# For JavaScript actions in host jobs (actions/checkout@v5 is node24).
RUNNER_NODE_VERSION=24.22.3
+25
View File
@@ -68,6 +68,31 @@ if [ "$current" != "v${VERSION}" ]; then
changed=1 changed=1
fi fi
# --- node (host-mode JavaScript actions) -------------------------------------
# In host mode the runner runs actions such as actions/checkout with the
# host's `node`. Only `node` goes on PATH: the job's own Node comes from
# actions/setup-node.
if [ -n "${RUNNER_NODE_VERSION:-}" ]; then
nv="v${RUNNER_NODE_VERSION}"
if [ "$(/usr/local/bin/node --version 2>/dev/null || true)" != "$nv" ]; then
case "$(uname -m)" in
x86_64) narch=x64 ;; aarch64) narch=arm64 ;; armv7l) narch=armv7l ;;
*) die "no Node build for $(uname -m)" ;;
esac
echo "Installing node ${nv} for host-mode actions"
ntmp=$(mktemp -d)
tarball="node-${nv}-linux-${narch}.tar.gz"
curl -fsSL "https://nodejs.org/dist/${nv}/${tarball}" -o "$ntmp/$tarball"
curl -fsSL "https://nodejs.org/dist/${nv}/SHASUMS256.txt" -o "$ntmp/SHASUMS256.txt"
(cd "$ntmp" && grep " ${tarball}\$" SHASUMS256.txt | sha256sum -c --quiet -)
rm -rf "/opt/node-${nv}"
mkdir -p "/opt/node-${nv}"
tar -xzf "$ntmp/$tarball" -C "/opt/node-${nv}" --strip-components=1 --no-same-owner
ln -sfn "/opt/node-${nv}/bin/node" /usr/local/bin/node
rm -rf "$ntmp"
fi
fi
# --- config ------------------------------------------------------------------ # --- config ------------------------------------------------------------------
# State (config.yaml and the .runner credential) lives outside this checkout, # State (config.yaml and the .runner credential) lives outside this checkout,
# so a git clean or re-clone never loses the registration. # so a git clean or re-clone never loses the registration.
+14
View File
@@ -19,6 +19,14 @@
registryUrlTemplate: "https://gitea.com", registryUrlTemplate: "https://gitea.com",
extractVersionTemplate: "^v(?<version>.+)$", extractVersionTemplate: "^v(?<version>.+)$",
}, },
{
// The host `node` that runs JavaScript actions in host-mode jobs.
customType: "regex",
managerFilePatterns: ["/^hosts/[^/]+\\.env$/"],
matchStrings: ["RUNNER_NODE_VERSION=(?<currentValue>[0-9][\\w.-]*)"],
depNameTemplate: "node",
datasourceTemplate: "node-version",
},
], ],
packageRules: [ packageRules: [
@@ -29,5 +37,11 @@
matchUpdateTypes: ["major"], matchUpdateTypes: ["major"],
prBodyNotes: ["Major release: check the minimum Gitea version in the release notes against stpgit before merging."], prBodyNotes: ["Major release: check the minimum Gitea version in the release notes against stpgit before merging."],
}, },
// Stay on the major that actions declare (`runs.using: node24`); move by hand.
{
matchDepNames: ["node"],
matchUpdateTypes: ["major"],
enabled: false,
},
], ],
} }