mirror of
https://github.com/casjaysdevdocker/gitea
synced 2024-11-23 05: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
26a5cc313c
commit
a4ffe6f245
@ -242,21 +242,27 @@ __run_pre_execute_checks() {
|
|||||||
[ -d "$CONF_DIR/tokens" ] || mkdir -p "$CONF_DIR/tokens"
|
[ -d "$CONF_DIR/tokens" ] || mkdir -p "$CONF_DIR/tokens"
|
||||||
if [ -f "$RUNNER_CONFIG_DEFAULT" ]; then
|
if [ -f "$RUNNER_CONFIG_DEFAULT" ]; then
|
||||||
if [ ! -f "$CONF_DIR/reg/default.sample" ]; then
|
if [ ! -f "$CONF_DIR/reg/default.sample" ]; then
|
||||||
|
echo "A sample registration file can be found in: $CONF_DIR/reg/default.sample" >/dev/stdout
|
||||||
cat <<EOF >"$CONF_DIR/reg/default.sample"
|
cat <<EOF >"$CONF_DIR/reg/default.sample"
|
||||||
# Edit this file and execute it
|
# Edit this file and execute it
|
||||||
exitStatus=1
|
exitStatus=1
|
||||||
RUNNER_NAME="default"
|
RUNNER_NAME="\$(hostname -f)"
|
||||||
RUNNER_HOME="$HOME/.config/act_runner"
|
RUNNER_HOME="\$HOME/.config/act_runner"
|
||||||
RUNNER_LABELS="$RUNNER_LABELS"
|
RUNNER_REGISTER_URL="https://$INSTANCE_HOSTNAME"
|
||||||
RUNNER_AUTH_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}"
|
RUNNER_AUTH_TOKEN="${RUNNER_AUTH_TOKEN:-$SYS_AUTH_TOKEN}"
|
||||||
RUNNER_HOSTNAME="${INSTANCE_HOSTNAME}"
|
RUNNER_LABELS="$RUNNER_LABELS"
|
||||||
RUNNER_REGISTER_URL="http://\${RUNNER_HOSTNAME}"
|
ACT_API_URL="\$(curl -q -LSsf -X 'GET' 'https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest' -H 'accept: application/json' | jq '.[]' | jq -rc '.[].browser_download_url' 2>/dev/null)"
|
||||||
mkdir -p "\$RUNNER_HOME"
|
mkdir -p "\$RUNNER_HOME"
|
||||||
[ -f \$RUNNER_HOME/config.yaml" ] || act_runner generate-config >"\$RUNNER_HOME/config.yaml"
|
case "\$(uname -m)" in x86_64) ACT_API_URL="$(echo "\$ACT_API_URL" | grep 'linux.*amd64$')" ;; aarch64) ACT_API_URL="(echo "\$ACT_API_URL"|grep 'linux.*aarch64$')" ;; *) echo "\$(uname -m) is not supported by this script" >&2 && exit 1 ;; esac
|
||||||
act_runner register --config "\$RUNNER_HOME/config.yaml" --labels "\$RUNNER_LABELS" --name "\$RUNNER_NAME" --instance "\$RUNNER_REGISTER_URL" --token "\$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0 || exitStatus=1
|
if [ -n "\$ACT_API_URL" ]; then
|
||||||
if [ "\$exitStatus" -eq 0 ]; then
|
curl -q -LSsf "\$ACT_API_URL" -o "/usr/local/bin/act_runner" && chmod -Rf 755 "/usr/local/bin/act_runner"
|
||||||
act_runner daemon --config $"\$RUNNER_HOME/config.yaml" &
|
[ -f \$RUNNER_HOME/config.yaml" ] || act_runner generate-config >"\$RUNNER_HOME/config.yaml"
|
||||||
|
act_runner register --config "\$RUNNER_HOME/config.yaml" --labels "\$RUNNER_LABELS" --name "\$RUNNER_NAME" --instance "\$RUNNER_REGISTER_URL" --token "\$RUNNER_AUTH_TOKEN" --no-interactive && exitStatus=0
|
||||||
|
if [ "\$exitStatus" -eq 0 ]; then
|
||||||
|
echo "Act runner has been registered with server: \$RUNNER_REGISTER_URL"
|
||||||
|
act_runner daemon --config "\$RUNNER_HOME/config.yaml" &
|
||||||
exitStatus=\$?
|
exitStatus=\$?
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
exit \$exitStatus
|
exit \$exitStatus
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user