From dad07f9819d5aaefd3fd5f39d6200312f7fa5bd5 Mon Sep 17 00:00:00 2001 From: casjay Date: Sun, 11 Aug 2024 20:12:18 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Committing=20everything?= =?UTF-8?q?=20that=20changed=20=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/etc/docker/init.d/zz-act_runner.sh --- .../local/etc/docker/init.d/zz-act_runner.sh | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) 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 4e39cca..468bd4c 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 @@ -268,22 +268,23 @@ EOF else [ -f "$runner" ] && . "$runner" if [ ! -f "$RUNNER_HOME/runners" ]; then - echo "RUNNER_AUTH_TOKEN has been set: trying to register $RUNNER_NAME" echo "creating $RUNNER_NAME in $RUNNER_HOME and registering with $RUNNER_REGISTER_URL" mkdir -p "$RUNNER_HOME" - cp -Rf "$ETC_DIR/multi.yaml" "$RUNNER_HOME/daemon.yaml" + [ -f "$RUNNER_HOME/daemon.yaml" ] || copy "$ETC_DIR/multi.yaml" "$RUNNER_HOME/daemon.yaml" __replace "REPLACE_RUNNER_HOME" "$RUNNER_HOME" "$RUNNER_HOME/daemon.yaml" __replace "REPLACE_RUNNER_TEMP" "$TMP_DIR/$RUNNER_NAME" "$RUNNER_HOME/daemon.yaml" - act_runner register --config "$RUNNER_HOME/daemon.yaml" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "$RUNNER_REGISTER_URL" --token "$RUNNER_AUTH_TOKEN" --no-interactive - if [ $? -eq 0 ] || [ -f "$RUNNER_HOME/runners" ]; then - cp -Rf "$runner" "$RUNNER_HOME/$RUNNER_NAME.reg" - chown -Rf "$SERVICE_USER":"$SERVICE_GROUP" "$RUNNER_HOME" - echo "$RUNNER_NAME has been registered" - exitStatus=${exitStatus:-0} - break - else - exitStatus=$((exitStatus++)) - sleep 20 + if grep -sq "$RUNNER_HOME" "$RUNNER_HOME/daemon.yaml" && grep -sq "$TMP_DIR/$RUNNER_NAME" "$RUNNER_HOME/daemon.yaml"; then + act_runner register --config "$RUNNER_HOME/daemon.yaml" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "$RUNNER_REGISTER_URL" --token "$RUNNER_AUTH_TOKEN" --no-interactive 2>/dev/stdout + if [ $? -eq 0 ] || [ -f "$RUNNER_HOME/runners" ]; then + copy "$runner" "$RUNNER_HOME/$RUNNER_NAME.reg" + chown -Rf "$SERVICE_USER":"$SERVICE_GROUP" "$RUNNER_HOME" + echo "$RUNNER_NAME has been registered" + exitStatus=${exitStatus:-0} + break + else + exitStatus=$((exitStatus++)) + sleep 20 + fi fi fi fi