fix(install): use env vars for act_runner auto-registration
gitea/act_runner entrypoint auto-registers on first start using GITEA_INSTANCE_URL and GITEA_RUNNER_REGISTRATION_TOKEN env vars, then starts the daemon. Remove the separate register step entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
376d27367c
commit
2345f10b21
1 changed files with 7 additions and 20 deletions
27
install.sh
27
install.sh
|
|
@ -778,31 +778,18 @@ do_forgejo_runner_install() {
|
||||||
|
|
||||||
mkdir -p "$FORGEJO_RUNNER_DIR"
|
mkdir -p "$FORGEJO_RUNNER_DIR"
|
||||||
|
|
||||||
log_step "Registering runner with Forgejo..."
|
# gitea/act_runner auto-registers on first start via env vars, then starts daemon
|
||||||
docker run --rm \
|
log_step "Starting Forgejo Runner (auto-register on first boot)..."
|
||||||
-v "${FORGEJO_RUNNER_DIR}:/data" \
|
|
||||||
"${FORGEJO_RUNNER_IMAGE}" \
|
|
||||||
register \
|
|
||||||
--no-interactive \
|
|
||||||
--instance "${forgejo_url}" \
|
|
||||||
--token "${runner_token}" \
|
|
||||||
--name "$(hostname)-runner" \
|
|
||||||
--labels "ubuntu-latest:docker://node:20-bullseye,ubuntu-22.04:docker://node:20-bullseye"
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
log_err "Runner registration failed. Check the token and Forgejo URL."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
log_ok "Runner registered."
|
|
||||||
|
|
||||||
log_step "Starting Forgejo Runner..."
|
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name "${FORGEJO_RUNNER_CONTAINER}" \
|
--name "${FORGEJO_RUNNER_CONTAINER}" \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
|
-e GITEA_INSTANCE_URL="${forgejo_url}" \
|
||||||
|
-e GITEA_RUNNER_REGISTRATION_TOKEN="${runner_token}" \
|
||||||
|
-e GITEA_RUNNER_NAME="$(hostname)-runner" \
|
||||||
|
-e GITEA_RUNNER_LABELS="ubuntu-latest:docker://node:20-bullseye,ubuntu-22.04:docker://node:20-bullseye" \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v "${FORGEJO_RUNNER_DIR}:/data" \
|
-v "${FORGEJO_RUNNER_DIR}:/data" \
|
||||||
"${FORGEJO_RUNNER_IMAGE}" \
|
"${FORGEJO_RUNNER_IMAGE}"
|
||||||
daemon
|
|
||||||
|
|
||||||
log_ok "Forgejo Runner started."
|
log_ok "Forgejo Runner started."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue