do not try to install the runner if it already available

This commit is contained in:
Earl Warren 2023-04-04 18:24:21 +02:00
parent f66ab11375
commit e97991ef78
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -13,18 +13,21 @@ function download() {
local runner_repository="$1"
local version="$2"
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-amd64 > /bin/forgejo-runner
chmod 755 /bin/forgejo-runner
if ! which forgejo-runner > /dev/null; then
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-amd64 > /bin/forgejo-runner
chmod 755 /bin/forgejo-runner
fi
}
function register() {
local forgejo="$1"
docker exec --user 1000 forgejo forgejo actions --registration-token-admin > forgejo-runner-token
timeout --signal=KILL 30 forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat forgejo-runner-token) --labels ubuntu-latest:docker://node:16-buster,self-hosted
timeout --signal=KILL 30 forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat forgejo-runner-token) --labels ubuntu-latest:docker://node:16-buster,self-hosted
}
function run() {
daemon --chdir=$(pwd) --unsafe --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log /bin/forgejo-runner daemon
rm -f forgejo-runner.log
daemon --chdir=$(pwd) --unsafe --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log forgejo-runner daemon
sleep 1
cat forgejo-runner.log
}