From 5c4560b74b3c123e55b11d5987f8b099193e73e3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 1 Jun 2025 19:27:45 +1200 Subject: [PATCH] 'Generic Commit' --- gitea-runner/config/.template_info.env | 10 ------ gitea-runner/config/service.env | 14 -------- gitea-runner/destroy.sh | 10 ------ gitea-runner/install.sh | 49 -------------------------- gitea-runner/start.sh | 28 --------------- gitea-runner/status.sh | 15 -------- gitea-runner/stop.sh | 15 -------- gitea-runner/uninstall.sh | 15 -------- 8 files changed, 156 deletions(-) delete mode 100644 gitea-runner/config/.template_info.env delete mode 100644 gitea-runner/config/service.env delete mode 100755 gitea-runner/destroy.sh delete mode 100755 gitea-runner/install.sh delete mode 100755 gitea-runner/start.sh delete mode 100755 gitea-runner/status.sh delete mode 100755 gitea-runner/stop.sh delete mode 100755 gitea-runner/uninstall.sh diff --git a/gitea-runner/config/.template_info.env b/gitea-runner/config/.template_info.env deleted file mode 100644 index 5c59935..0000000 --- a/gitea-runner/config/.template_info.env +++ /dev/null @@ -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 diff --git a/gitea-runner/config/service.env b/gitea-runner/config/service.env deleted file mode 100644 index 370fe20..0000000 --- a/gitea-runner/config/service.env +++ /dev/null @@ -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" - diff --git a/gitea-runner/destroy.sh b/gitea-runner/destroy.sh deleted file mode 100755 index b528477..0000000 --- a/gitea-runner/destroy.sh +++ /dev/null @@ -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}" diff --git a/gitea-runner/install.sh b/gitea-runner/install.sh deleted file mode 100755 index d9195d0..0000000 --- a/gitea-runner/install.sh +++ /dev/null @@ -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}." diff --git a/gitea-runner/start.sh b/gitea-runner/start.sh deleted file mode 100755 index 04f0dfb..0000000 --- a/gitea-runner/start.sh +++ /dev/null @@ -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" - - diff --git a/gitea-runner/status.sh b/gitea-runner/status.sh deleted file mode 100755 index 428ad89..0000000 --- a/gitea-runner/status.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/gitea-runner/stop.sh b/gitea-runner/stop.sh deleted file mode 100755 index 260eae5..0000000 --- a/gitea-runner/stop.sh +++ /dev/null @@ -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" diff --git a/gitea-runner/uninstall.sh b/gitea-runner/uninstall.sh deleted file mode 100755 index 503e05e..0000000 --- a/gitea-runner/uninstall.sh +++ /dev/null @@ -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}"