mirror of
https://github.com/casjaysdevdocker/gitea
synced 2024-11-21 11:23:07 -05:00
🗃️ Committing everything that changed 🗃️
rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh
This commit is contained in:
parent
8f627d680a
commit
5e414b76ae
@ -257,7 +257,6 @@ fi
|
||||
exit \$exitStatus
|
||||
|
||||
EOF
|
||||
chmod -Rf 755 "$CONF_DIR/reg/default.sample"
|
||||
fi
|
||||
if [ ! -f "$CONF_DIR/reg/runner-1.reg" ]; then
|
||||
cat <<EOF >"$CONF_DIR/reg/runner-1.reg"
|
||||
@ -283,7 +282,7 @@ RUNNER_LABELS="$RUNNER_LABELS"
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
chmod -Rf 755 "$CONF_DIR/reg"/*
|
||||
mkdir -p "$RUNNER_DEFAULT_HOME" "$TMP_DIR/runners/gitea"
|
||||
[ -f "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME" ] || copy "$RUNNER_CONFIG_DEFAULT" "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME"
|
||||
if [ ! -f "$RUNNER_DEFAULT_HOME/runners" ] && [ -n "$SYS_AUTH_TOKEN" ] && [ -f "$RUNNER_DEFAULT_HOME/$RUNNER_CONFIG_NAME" ]; then
|
||||
@ -297,7 +296,8 @@ EOF
|
||||
|
||||
for runner in "$CONF_DIR/reg"/*.reg; do
|
||||
echo "Setting up $runner"
|
||||
[ -f "$runner" ] && . "$runner"
|
||||
if [ -f "$runner" ]; then
|
||||
. "$runner"
|
||||
while :; do
|
||||
RUNNER_LABELS="${RUNNER_LABELS:-act_runner}"
|
||||
RUNNER_NAME="${RUNNER_NAME:-$(basename "${runner//.reg/}")}"
|
||||
@ -335,10 +335,13 @@ EOF
|
||||
__replace "REPLACE_RUNNER_CACHE_PORT" "$RUNNER_CACHE_PORT" "$RUNNER_HOME/$RUNNER_CONFIG_NAME"
|
||||
if grep -sq "$RUNNER_HOME" "$RUNNER_HOME/$RUNNER_CONFIG_NAME" && grep -sq "$TMP_DIR/runners/$RUNNER_NAME" "$RUNNER_HOME/$RUNNER_CONFIG_NAME"; then
|
||||
if [ -f "$RUNNER_HOME/runners" ]; then
|
||||
echo "Runner exists in: $RUNNER_HOME/runners" >&2
|
||||
break
|
||||
else
|
||||
act_runner register --config "$RUNNER_HOME/$RUNNER_CONFIG_NAME" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "$RUNNER_REGISTER_URL" --token "$RUNNER_AUTH_TOKEN" --no-interactive 2>/dev/stdout >>"$LOG_DIR/runners.log"
|
||||
if [ $? -eq 0 ] || [ -f "$RUNNER_HOME/runners" ]; then
|
||||
(act_runner register --config "$RUNNER_HOME/$RUNNER_CONFIG_NAME" --labels "$RUNNER_LABELS" --name "$RUNNER_NAME" --instance "$RUNNER_REGISTER_URL" --token "$RUNNER_AUTH_TOKEN" --no-interactive 2>/dev/stdout >>"$LOG_DIR/runners.log" && sleep 10) &
|
||||
pid=$(__pid_exists $!)
|
||||
sleep 4
|
||||
if [ -n "$pid" ] || [ -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"
|
||||
@ -353,11 +356,13 @@ EOF
|
||||
else
|
||||
exitStatus=$((exitStatus++))
|
||||
echo "Something seems to have gone wrong modifying $RUNNER_HOME/$RUNNER_CONFIG_NAME" >&2
|
||||
break
|
||||
fi
|
||||
fi
|
||||
echo "$RUNNER_NAME seems to be configured"
|
||||
unset RUNNER_HOME RUNNER_NAME RUNNER_AUTH_TOKEN RUNNER_HOSTNAME RUNNER_REGISTER_URL
|
||||
done
|
||||
fi
|
||||
echo "Done proccessing $runner"
|
||||
done 2>"/dev/stderr" | tee -p -a "$LOG_DIR/init.txt" >/dev/null
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user