1
0
mirror of https://git.cloudron.io/cloudron/gitea-app synced 2025-09-27 23:47:28 +00:00

act_runner implemented

This commit is contained in:
Vladimir D
2025-05-08 22:26:58 +04:00
parent d0d4b89f12
commit 626326f65e
5 changed files with 58 additions and 8 deletions

View File

@@ -2,7 +2,9 @@
set -eu -o pipefail
mkdir -p /run/gitea/tmp/uploads /run/sshd /run/gitea/sessions
mkdir -p /run/gitea/tmp/uploads /run/sshd /run/gitea/sessions /app/data/act_runner
export DOCKER_HOST=${CLOUDRON_DOCKER_HOST}
# CLOUDRON_OIDC_PROVIDER_NAME not supported as it will be used in rest route!
setup_oidc_source() {
@@ -26,14 +28,37 @@ setup_root_user() {
fi
}
setup_auth() {
set -eu
setup_act_runner() {
wait_for_gitea
# Wait for gitea to finish db setup, before we do any db operations
while ! curl --fail http://localhost:3000/explore; do
if [[ ! -f /app/data/act_runner/.runner ]]; then
echo "==> Setup act_runner"
RUNNER_TOKEN=$(gosu git /home/git/gitea/gitea --config /run/gitea/app.ini actions generate-runner-token)
echo "===> act_runner token: ${RUNNER_TOKEN}"
if [[ ! -f /app/data/act_runner/config.yaml ]]; then
gosu git act_runner generate-config > /app/data/act_runner/config.yaml
fi
yq -e -i ".runner.file=\"/app/data/act_runner/.runner\"" /app/data/act_runner/config.yaml
echo "===> Register act_runner"
gosu git act_runner register --instance http://localhost:3000 --token ${RUNNER_TOKEN} --name 'cloudron-runner' --config /app/data/act_runner/config.yaml --no-interactive
fi
}
wait_for_gitea() {
while ! curl --fail -s http://localhost:3000/explore > /dev/null; do
echo "==> Waiting for gitea to come up"
sleep 1
done
}
setup() {
set -eu
# Wait for gitea to finish db setup, before we do any db operations
wait_for_gitea
echo "==> Gitea is up, setting up auth"
@@ -47,6 +72,9 @@ setup_auth() {
echo "==> Setting up root user for first run"
setup_root_user
fi
# setup act_runner
setup_act_runner
}
# SSH_PORT can be unset to disable SSH
@@ -120,6 +148,6 @@ mkdir -p /app/data/repository /app/data/ssh /app/data/custom /app/data/gnupg
chown -R git:git /app/data /run/gitea
# this expects app.ini to be available
( setup_auth ) &
( setup ) &
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gitea