ver 0.1
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# register-runner.sh — standalone registration helper (run outside container)
|
||||
# Useful for pre-generating config before first container start.
|
||||
set -euo pipefail
|
||||
|
||||
: "${GITEA_INSTANCE_URL:?GITEA_INSTANCE_URL must be set}"
|
||||
: "${GITEA_RUNNER_TOKEN:?GITEA_RUNNER_TOKEN must be set}"
|
||||
: "${GITEA_RUNNER_NAME:?GITEA_RUNNER_NAME must be set}"
|
||||
|
||||
RUNNER_CONFIG_PATH="${RUNNER_CONFIG_PATH:-./config/runner.yaml}"
|
||||
GITEA_RUNNER_LABELS="${GITEA_RUNNER_LABELS:-ubuntu-latest:docker://node:20-bullseye}"
|
||||
|
||||
echo "Registering runner: ${GITEA_RUNNER_NAME}"
|
||||
echo " Instance : ${GITEA_INSTANCE_URL}"
|
||||
echo " Config : ${RUNNER_CONFIG_PATH}"
|
||||
echo " Labels : ${GITEA_RUNNER_LABELS}"
|
||||
|
||||
mkdir -p "$(dirname "${RUNNER_CONFIG_PATH}")"
|
||||
|
||||
docker run --rm \
|
||||
-v "$(pwd)/config:/config" \
|
||||
-e GITEA_INSTANCE_URL="${GITEA_INSTANCE_URL}" \
|
||||
-e GITEA_RUNNER_TOKEN="${GITEA_RUNNER_TOKEN}" \
|
||||
-e GITEA_RUNNER_NAME="${GITEA_RUNNER_NAME}" \
|
||||
-e GITEA_RUNNER_LABELS="${GITEA_RUNNER_LABELS}" \
|
||||
-e RUNNER_CONFIG_PATH="/config/runner.yaml" \
|
||||
custom-gitea-runner:latest \
|
||||
act_runner register \
|
||||
--config /config/runner.yaml \
|
||||
--instance "${GITEA_INSTANCE_URL}" \
|
||||
--token "${GITEA_RUNNER_TOKEN}" \
|
||||
--name "${GITEA_RUNNER_NAME}" \
|
||||
--labels "${GITEA_RUNNER_LABELS}" \
|
||||
--no-interactive
|
||||
|
||||
echo "Registration complete. Config written to ${RUNNER_CONFIG_PATH}."
|
||||
Reference in New Issue
Block a user