WBS-7.9: target snapshot admin deploy host runner
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
GITEA_URL="${GITEA_URL:-http://192.168.123.100:8418}"
|
||||
REG_TOKEN="${REG_TOKEN:-}"
|
||||
RUNNER_NAME="${RUNNER_NAME:-synology-runner}"
|
||||
RUNNER_LABEL="${RUNNER_LABEL:-snapshot-admin-host}"
|
||||
RUNNER_DIR="${RUNNER_DIR:-/volume1/gitea/act_runner}"
|
||||
ACT_RUNNER_VERSION="${ACT_RUNNER_VERSION:-0.2.11}"
|
||||
|
||||
if [ -z "$REG_TOKEN" ]; then
|
||||
echo "ERROR: REG_TOKEN is required"
|
||||
echo "usage: REG_TOKEN=... GITEA_URL=... bash tools/re_register_act_runner_synology.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-amd64" ;;
|
||||
aarch64) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-arm64" ;;
|
||||
armv7l) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-arm-7" ;;
|
||||
*) echo "ERROR: 지원하지 않는 아키텍처: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
mkdir -p "$RUNNER_DIR/workspace"
|
||||
|
||||
if [ ! -x "$RUNNER_DIR/act_runner" ]; then
|
||||
DOWNLOAD_URL="https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/${BINARY}"
|
||||
echo "[install] $DOWNLOAD_URL"
|
||||
curl -L --progress-bar "$DOWNLOAD_URL" -o "$RUNNER_DIR/act_runner"
|
||||
chmod +x "$RUNNER_DIR/act_runner"
|
||||
fi
|
||||
|
||||
cat > "$RUNNER_DIR/config.yaml" <<YAML
|
||||
runner:
|
||||
name: ${RUNNER_NAME}
|
||||
labels:
|
||||
- "self-hosted:host"
|
||||
- "${RUNNER_LABEL}:host"
|
||||
|
||||
host:
|
||||
workdir_parent: ${RUNNER_DIR}/workspace
|
||||
YAML
|
||||
|
||||
echo "[register] removing previous registration"
|
||||
rm -f "$RUNNER_DIR/.runner"
|
||||
|
||||
echo "[register] registering as host runner"
|
||||
"$RUNNER_DIR/act_runner" register \
|
||||
--no-interactive \
|
||||
--instance "$GITEA_URL" \
|
||||
--token "$REG_TOKEN" \
|
||||
--name "$RUNNER_NAME" \
|
||||
--labels "self-hosted:host,${RUNNER_LABEL}:host" \
|
||||
--config "$RUNNER_DIR/config.yaml"
|
||||
|
||||
echo "re-registration complete"
|
||||
echo "start with: bash /volume1/projects/data_feed/tools/start_act_runner_synology.sh"
|
||||
Reference in New Issue
Block a user