'Generic Commit'
This commit is contained in:
parent
cc47b21005
commit
5c4560b74b
@ -1,10 +0,0 @@
|
||||
# DO NOT EDIT THIS FILE FOR YOUR SERVICE!
|
||||
# This file is replaced from the template whenever there is an update.
|
||||
# Edit the service.env file to make changes.
|
||||
|
||||
|
||||
# Template to use - always required!
|
||||
TEMPLATE=gitea-runner
|
||||
REQUIRES_HOST_ROOT=false
|
||||
REQUIRES_DOCKER=true
|
||||
REQUIRES_DOCKER_ROOT=true
|
@ -1,14 +0,0 @@
|
||||
# Service settings specific to this server
|
||||
# (can also override anything in the .template_info.env file in the template to make it specific to this server)
|
||||
|
||||
# $HOME etc expanded on remote server by bash.
|
||||
GITEA_RUNNER_DIRECTORY="${HOME}/.gitea-runner"
|
||||
ACT_RUNNER_VERSION="0.2.11"
|
||||
GITEA_URL="https://gitea.jde.nz"
|
||||
GITEA_TOKEN="GITEA_TOKEN"
|
||||
GITEA_RUNNER_NAME="${SERVER}-${SERVICE}"
|
||||
GITEA_RUNNER_LABELS="ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster"
|
||||
|
||||
# Server Settings
|
||||
SSH_USER="dropshell"
|
||||
|
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "SERVER" "SERVICE" "GITEA_RUNNER_DIRECTORY"
|
||||
|
||||
# Call uninstall script first
|
||||
./uninstall.sh
|
||||
|
||||
echo "Destroyed ${SERVICE}"
|
@ -1,49 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
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"
|
||||
|
||||
echo "Downloading act_runner ${ACT_RUNNER_VERSION}..."
|
||||
wget https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64 -O "${TEMP_DIR}/act_runner"
|
||||
|
||||
chmod +x "${TEMP_DIR}/act_runner" || _die "Failed to download ${TEMP_DIR}/act_runner"
|
||||
|
||||
ACT_RUNNER="${GITEA_RUNNER_DIRECTORY}/act_runner"
|
||||
CONFIG_FILE="${GITEA_RUNNER_DIRECTORY}/config.yaml"
|
||||
|
||||
echo "Checking version..."
|
||||
mkdir -p "${GITEA_RUNNER_DIRECTORY}" || _die "Failed to create ${GITEA_RUNNER_DIRECTORY}"
|
||||
cp "${TEMP_DIR}/act_runner" "$ACT_RUNNER" || _die "Failed to copy ${TEMP_DIR}/act_runner to ${GITEA_RUNNER_DIRECTORY}/act_runner"
|
||||
${ACT_RUNNER} --version || _die "Failed to run ${ACT_RUNNER}"
|
||||
|
||||
# only register once!
|
||||
if [ ! -f "${CONFIG_FILE}" ]; then
|
||||
echo "Generating config.yaml..."
|
||||
${ACT_RUNNER} generate-config > "${CONFIG_FILE}" || _die "Failed to generate config.yaml"
|
||||
|
||||
# replace the " file: .runner" line with " file: ${GITEA_RUNNER_DIRECTORY}/registration" in config.yaml
|
||||
sed -i "s|[[:space:]]*file:[[:space:]]*\.runner| file: ${GITEA_RUNNER_DIRECTORY}/registration|" "${CONFIG_FILE}"
|
||||
|
||||
echo "Registering runner..."
|
||||
${ACT_RUNNER} --config "${CONFIG_FILE}" \
|
||||
register --no-interactive \
|
||||
--instance "${GITEA_URL}" \
|
||||
--token "${GITEA_TOKEN}" \
|
||||
--name "${GITEA_RUNNER_NAME}" \
|
||||
--labels "${GITEA_RUNNER_LABELS}"
|
||||
else
|
||||
echo "Runner already registered."
|
||||
fi
|
||||
|
||||
[ -f "${CONFIG_FILE}" ] || _die "Failed to create ${CONFIG_FILE}"
|
||||
[ -f "${ACT_RUNNER}" ] || _die "Failed to create ${ACT_RUNNER}"
|
||||
|
||||
echo "CONFIG_FILE: ${CONFIG_FILE}"
|
||||
echo "ACT_RUNNER: ${ACT_RUNNER}"
|
||||
|
||||
./start.sh || _die "Failed to start"
|
||||
|
||||
echo "Installation complete for service ${SERVICE}."
|
@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "SERVER" "SERVICE" "GITEA_RUNNER_DIRECTORY"
|
||||
|
||||
# START SCRIPT
|
||||
# The start script is required for all templates.
|
||||
# It is used to start the service on the server.
|
||||
# It is called with the path to the server specific env file as an argument.
|
||||
|
||||
ACT_RUNNER="${GITEA_RUNNER_DIRECTORY}/act_runner"
|
||||
CONFIG_FILE="${GITEA_RUNNER_DIRECTORY}/config.yaml"
|
||||
|
||||
echo "Starting act_runner..."
|
||||
"${ACT_RUNNER}" daemon --config "${CONFIG_FILE}" >/dev/null 2>&1 &
|
||||
|
||||
# Add a short delay to allow the background process to start
|
||||
sleep 2
|
||||
if pgrep -f "${ACT_RUNNER}" > /dev/null; then
|
||||
echo "act_runner started successfully."
|
||||
else
|
||||
_die "Failed to start act_runner process."
|
||||
fi
|
||||
|
||||
echo "Started $SERVICE"
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "SERVER" "SERVICE" "GITEA_RUNNER_DIRECTORY"
|
||||
|
||||
|
||||
# check if the act_runner process is running
|
||||
if ! pgrep -f "${GITEA_RUNNER_DIRECTORY}/act_runner" > /dev/null; then
|
||||
echo "act_runner is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "act_runner is running"
|
||||
exit 0
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "SERVER" "SERVICE" "GITEA_RUNNER_DIRECTORY"
|
||||
|
||||
# kill the act_runner process
|
||||
if pgrep -f "${GITEA_RUNNER_DIRECTORY}/act_runner" > /dev/null; then
|
||||
pkill -f "${GITEA_RUNNER_DIRECTORY}/act_runner"
|
||||
echo "act_runner stopped"
|
||||
else
|
||||
echo "act_runner is not running"
|
||||
fi
|
||||
|
||||
echo "Stopped $SERVICE"
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source "${AGENT_PATH}/common.sh"
|
||||
_check_required_env_vars "SERVER" "SERVICE" "GITEA_RUNNER_DIRECTORY"
|
||||
|
||||
echo "Uninstalling service ${SERVICE}..."
|
||||
|
||||
./stop.sh || _die "Failed to stop act_runner"
|
||||
|
||||
rm "${GITEA_RUNNER_DIRECTORY}/act_runner"
|
||||
|
||||
# leave the config.yaml file alone. Have to manually deregister in gitea.
|
||||
|
||||
echo "Uninstalled ${SERVICE}"
|
Loading…
x
Reference in New Issue
Block a user