🗃️ Committing everything that changed 🗃️

rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
casjay 2024-08-11 17:11:37 -04:00
parent bad98e7c1e
commit 93f1dbd185
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145

View File

@ -268,16 +268,18 @@ EOF
continue continue
else else
[ -f "$runner" ] && . "$runner" [ -f "$runner" ] && . "$runner"
echo "creating $RUNNER_NAME in $RUNNER_HOME and setting hostname to $RUNNER_HOSTNAME"
mkdir -p "$RUNNER_HOME" mkdir -p "$RUNNER_HOME"
cp -Rf "$CONF_DIR/multi.yaml" "$RUNNER_HOME/daemon.yaml" cp -Rf "$CONF_DIR/multi.yaml" "$RUNNER_HOME/daemon.yaml"
__replace "REPLACE_RUNNER_TEMP" "$TMP_DIR/$RUNNER_NAME" "$RUNNER_HOME/$RUNNER_NAME.yaml" __replace "REPLACE_RUNNER_TEMP" "$TMP_DIR/$RUNNER_NAME" "$RUNNER_HOME/$RUNNER_NAME.yaml"
__replace "REPLACE_RUNNER_HOME" "$RUNNER_HOME" "$RUNNER_HOME/$RUNNER_NAME.yaml" __replace "REPLACE_RUNNER_HOME" "$RUNNER_HOME" "$RUNNER_HOME/$RUNNER_NAME.yaml"
act_runner register --config "$RUNNER_HOME/$RUNNER_NAME.yaml" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "http://$CONTAINER_IP4_ADDRESS:8000" --token "$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0 || exitStatus=1 act_runner register --config "$RUNNER_HOME/daemon.yaml" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "http://$CONTAINER_IP4_ADDRESS:8000" --token "$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0 || exitStatus=1
if [ $exitStatus -eq 0 ]; then if [ $exitStatus -eq 0 ]; then
exitStatus=0 exitStatus=0
cp -Rf "$runner" "$RUNNER_HOME/$RUNNER_NAME.reg" cp -Rf "$runner" "$RUNNER_HOME/$RUNNER_NAME.reg"
chown -Rf "$SERVICE_USER":"$SERVICE_GROUP" "$RUNNER_HOME" chown -Rf "$SERVICE_USER":"$SERVICE_GROUP" "$RUNNER_HOME"
echo "$!" >"$RUN_DIR/act_runner.$RUNNER_NAME.pid" echo "$!" >"$RUN_DIR/act_runner.$RUNNER_NAME.pid"
echo "$RUNNER_NAME has been registered"
break break
else else
[ -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid" ] && rm -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid" [ -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid" ] && rm -f "$RUN_DIR/act_runner.$RUNNER_NAME.pid"
@ -386,6 +388,9 @@ __post_execute() {
sleep 5 && ps ax | awk '{print $1}' | grep -v grep | grep -q "$pid$" && is_running="yes" sleep 5 && ps ax | awk '{print $1}' | grep -v grep | grep -q "$pid$" && is_running="yes"
if [ "$is_running" = "yes" ]; then if [ "$is_running" = "yes" ]; then
echo "$pid" >"$RUN_DIR/act_runner.$name.pid" echo "$pid" >"$RUN_DIR/act_runner.$name.pid"
echo "$name has been started with pid: $pid" | tee -a -p "$LOG_DIR/init.txt"
else
echo "$name has failed to start" >/dev/stderr
fi fi
fi fi
fi fi