Update 4 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 1m1s

This commit is contained in:
j
2025-12-17 23:33:14 +13:00
parent 8194500a38
commit de6ad1db93
4 changed files with 33 additions and 17 deletions

View File

@@ -5,11 +5,24 @@ source "${AGENT_PATH}/common.sh"
_check_required_env_vars "SERVER" "SERVICE" "TEMP_DIR" \
"GITEA_RUNNER_DIRECTORY" "ACT_RUNNER_VERSION" \
"GITEA_URL" "GITEA_TOKEN" "GITEA_RUNNER_NAME" "GITEA_RUNNER_LABELS" \
"CONTAINER_NAME"
"CONTAINER_NAME" "REGISTRATION_ID"
mkdir -p "${GITEA_RUNNER_DIRECTORY}" || _die "Failed to create ${GITEA_RUNNER_DIRECTORY}"
# Check if registration ID changed - if so, clear old registration
STORED_REG_ID_FILE="${GITEA_RUNNER_DIRECTORY}/.registration_id"
STORED_REG_ID=""
if [[ -f "$STORED_REG_ID_FILE" ]]; then
STORED_REG_ID=$(cat "$STORED_REG_ID_FILE")
fi
if [[ "$STORED_REG_ID" != "$REGISTRATION_ID" ]]; then
echo "Registration ID changed ($STORED_REG_ID -> $REGISTRATION_ID), clearing old registration..."
rm -f "${GITEA_RUNNER_DIRECTORY}/.runner"
echo "$REGISTRATION_ID" > "$STORED_REG_ID_FILE"
fi
./start.sh || _die "Failed to start"
echo "Installation complete for service ${SERVICE}."