🗃️ Update codebase 🗃️

rootfs/usr/local/bin/start-runners
rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
casjay
2025-11-29 12:50:30 -05:00
parent 141582499f
commit 5d367f60cf
2 changed files with 15 additions and 10 deletions

View File

@@ -32,15 +32,15 @@ fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RUNNER_LABELS="${RUNNER_LABELS:-ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye}" RUNNER_LABELS="${RUNNER_LABELS:-ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye}"
# Determine number of runners to start # Determine number of runners to start
RUNNERS_COUNT=${RUNNERS_ENABLE:-1} RUNNERS_START=${RUNNERS_START:-1}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Validate RUNNERS_COUNT is a positive integer # Validate RUNNERS_START is a positive integer
if ! [[ "$RUNNERS_COUNT" =~ ^[0-9]+$ ]] || [ "$RUNNERS_COUNT" -lt 1 ]; then if ! [[ "$RUNNERS_START" =~ ^[0-9]+$ ]] || [ "$RUNNERS_START" -lt 1 ]; then
__log "WARNING: Invalid RUNNERS_ENABLE value '$RUNNERS_ENABLE', defaulting to 1" __log "WARNING: Invalid RUNNERS_START value '$RUNNERS_START', defaulting to 1"
RUNNERS_COUNT=1 RUNNERS_START=1
fi fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__log "Starting $RUNNERS_COUNT act_runner instance(s)" __log "Starting $RUNNERS_START act_runner instance(s)"
__log "Server Address: $SERVER_ADDRESS" __log "Server Address: $SERVER_ADDRESS"
__log "Runner Name Prefix: ${RUNNER_NAME_PREFIX:-runner}" __log "Runner Name Prefix: ${RUNNER_NAME_PREFIX:-runner}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -69,17 +69,18 @@ __start_runner() {
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Start runners in background # Start runners in background
for i in $(seq 1 $RUNNERS_COUNT); do for i in $(seq 1 $RUNNERS_START); do
(__start_runner $i) & (__start_runner $i) &
sleep 2 # Small delay between starting runners # Small delay between starting runners
sleep 2
done done
unset i unset i
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RUNNERS_ID="$(jobs -p | tr '\n' ' ')" RUNNERS_ID="$(jobs -p | tr '\n' ' ')"
if [ -n "$RUNNERS_ID" ]; then if [ -n "$RUNNERS_ID" ]; then
__log "All $RUNNERS_COUNT runners started successfully" __log "All $RUNNERS_START runners started successfully"
__log "Process IDs: $RUNNERS_ID" __log "Process IDs: $RUNNERS_ID"
printf 'All %s runners started successfully: %s\n' "$RUNNERS_COUNT" "$RUNNERS_ID" printf 'All %s runners started successfully: %s\n' "$RUNNERS_START" "$RUNNERS_ID"
else else
__log "The runners have failed to start" __log "The runners have failed to start"
printf '%s\n' "The runners have failed to start" printf '%s\n' "The runners have failed to start"

View File

@@ -196,6 +196,7 @@ GITEA_PORT="${GITEA_PORT:-80}"
SYS_AUTH_TOKEN="$(__gen_auth_token)" SYS_AUTH_TOKEN="$(__gen_auth_token)"
GITEA_USER="${GITEA_USER:-SERVICE_USER}" GITEA_USER="${GITEA_USER:-SERVICE_USER}"
INSTANCE_HOSTNAME="${GITEA_HOSTNAME:-$HOSTNAME}" INSTANCE_HOSTNAME="${GITEA_HOSTNAME:-$HOSTNAME}"
RUNNERS_START="${RUNNERS_START:-5}"
RUNNER_CACHE_PORT="${RUNNER_CACHE_PORT:-$SERVICE_PORT}" RUNNER_CACHE_PORT="${RUNNER_CACHE_PORT:-$SERVICE_PORT}"
RUNNER_LABELS="linux:host," RUNNER_LABELS="linux:host,"
RUNNER_LABELS+="node14:docker://node:14," RUNNER_LABELS+="node14:docker://node:14,"
@@ -361,6 +362,9 @@ __post_execute() {
local ctime=${POST_EXECUTE_WAIT_TIME:-1} # how long to wait before executing local ctime=${POST_EXECUTE_WAIT_TIME:-1} # how long to wait before executing
local postMessageST="Running post commands for $SERVICE_NAME" # message to show at start local postMessageST="Running post commands for $SERVICE_NAME" # message to show at start
local postMessageEnd="Finished post commands for $SERVICE_NAME" # message to show at completion local postMessageEnd="Finished post commands for $SERVICE_NAME" # message to show at completion
export RUNNERS_START="${RUNNERS_START:-5}" RUNNER_LABELS RUNNERS_LOG_DIR="$LOG_DIR"
export SERVER_ADDRESS="$RUNNER_IP_ADDRESS:$GITEA_PORT" SERVER_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}"
# wait # wait
sleep $waitTime sleep $waitTime
# execute commands after waiting # execute commands after waiting