mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 20:50:58 -05:00
do not try to install the runner if it already available
This commit is contained in:
parent
f66ab11375
commit
e97991ef78
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue