From 5d367f60cf033f50d7babb03b81bdc44502b184c Mon Sep 17 00:00:00 2001 From: casjay Date: Sat, 29 Nov 2025 12:50:30 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Update=20codebase=20?= =?UTF-8?q?=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/bin/start-runners rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh --- rootfs/usr/local/bin/start-runners | 21 ++++++++++--------- .../local/etc/docker/init.d/zz-act_runner.sh | 4 ++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/rootfs/usr/local/bin/start-runners b/rootfs/usr/local/bin/start-runners index 36d62bc..9dd446f 100755 --- a/rootfs/usr/local/bin/start-runners +++ b/rootfs/usr/local/bin/start-runners @@ -32,15 +32,15 @@ fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RUNNER_LABELS="${RUNNER_LABELS:-ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye}" # Determine number of runners to start -RUNNERS_COUNT=${RUNNERS_ENABLE:-1} +RUNNERS_START=${RUNNERS_START:-1} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Validate RUNNERS_COUNT is a positive integer -if ! [[ "$RUNNERS_COUNT" =~ ^[0-9]+$ ]] || [ "$RUNNERS_COUNT" -lt 1 ]; then - __log "WARNING: Invalid RUNNERS_ENABLE value '$RUNNERS_ENABLE', defaulting to 1" - RUNNERS_COUNT=1 +# Validate RUNNERS_START is a positive integer +if ! [[ "$RUNNERS_START" =~ ^[0-9]+$ ]] || [ "$RUNNERS_START" -lt 1 ]; then + __log "WARNING: Invalid RUNNERS_START value '$RUNNERS_START', defaulting to 1" + RUNNERS_START=1 fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__log "Starting $RUNNERS_COUNT act_runner instance(s)" +__log "Starting $RUNNERS_START act_runner instance(s)" __log "Server Address: $SERVER_ADDRESS" __log "Runner Name Prefix: ${RUNNER_NAME_PREFIX:-runner}" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -69,17 +69,18 @@ __start_runner() { } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Start runners in background -for i in $(seq 1 $RUNNERS_COUNT); do +for i in $(seq 1 $RUNNERS_START); do (__start_runner $i) & - sleep 2 # Small delay between starting runners + # Small delay between starting runners + sleep 2 done unset i # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RUNNERS_ID="$(jobs -p | tr '\n' ' ')" if [ -n "$RUNNERS_ID" ]; then - __log "All $RUNNERS_COUNT runners started successfully" + __log "All $RUNNERS_START runners started successfully" __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 __log "The runners have failed to start" printf '%s\n' "The runners have failed to start" diff --git a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh index 634ba72..c428040 100755 --- a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh @@ -196,6 +196,7 @@ GITEA_PORT="${GITEA_PORT:-80}" SYS_AUTH_TOKEN="$(__gen_auth_token)" GITEA_USER="${GITEA_USER:-SERVICE_USER}" INSTANCE_HOSTNAME="${GITEA_HOSTNAME:-$HOSTNAME}" +RUNNERS_START="${RUNNERS_START:-5}" RUNNER_CACHE_PORT="${RUNNER_CACHE_PORT:-$SERVICE_PORT}" RUNNER_LABELS="linux:host," 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 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 + 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 sleep $waitTime # execute commands after waiting