mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-23 22:31:04 -05:00
Merge pull request 'cleanup the runner cache when uploading self action' (#63) from earl-warren/setup-forgejo:wip-runner-cache into main
Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/63 Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
commit
6821c1eaf7
3 changed files with 12 additions and 2 deletions
|
@ -27,6 +27,7 @@ function download() {
|
||||||
|
|
||||||
function register() {
|
function register() {
|
||||||
local forgejo="$1"
|
local forgejo="$1"
|
||||||
|
mktemp -d > forgejo-runner-home
|
||||||
docker exec --user 1000 forgejo forgejo actions generate-runner-token > forgejo-runner-token
|
docker exec --user 1000 forgejo forgejo actions generate-runner-token > forgejo-runner-token
|
||||||
timeout --signal=KILL 30 forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat forgejo-runner-token) --labels docker:docker://code.forgejo.org/oci/node:16-bullseye,ubuntu-latest:docker://code.forgejo.org/oci/node:16-buster,self-hosted
|
timeout --signal=KILL 30 forgejo-runner register --no-interactive --instance "$forgejo" --name runner --token $(cat forgejo-runner-token) --labels docker:docker://code.forgejo.org/oci/node:16-bullseye,ubuntu-latest:docker://code.forgejo.org/oci/node:16-buster,self-hosted
|
||||||
}
|
}
|
||||||
|
@ -34,7 +35,7 @@ function register() {
|
||||||
function run() {
|
function run() {
|
||||||
rm -f forgejo-runner.log
|
rm -f forgejo-runner.log
|
||||||
daemon --chdir=$(pwd) --unsafe \
|
daemon --chdir=$(pwd) --unsafe \
|
||||||
--env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" \
|
--env="TERM=$TERM" --env="HOME=$(cat forgejo-runner-home)" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" \
|
||||||
--pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- \
|
--pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- \
|
||||||
forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -78,6 +79,7 @@ function stop_daemon() {
|
||||||
|
|
||||||
function teardown() {
|
function teardown() {
|
||||||
stop_daemon forgejo-runner
|
stop_daemon forgejo-runner
|
||||||
|
rm -fr $(cat forgejo-runner-home)
|
||||||
}
|
}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
|
@ -174,12 +174,20 @@ function run_workflow() {
|
||||||
wait_success "$url" "$owner/$project" $(cat $DIR/$project/SHA)
|
wait_success "$url" "$owner/$project" $(cat $DIR/$project/SHA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clear_runner_cache() {
|
||||||
|
if test -f forgejo-runner-home ; then
|
||||||
|
rm -fr $(cat forgejo-runner-home)/.cache/act
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function push_self_action() {
|
function push_self_action() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local owner="$2"
|
local owner="$2"
|
||||||
local self_action="$3"
|
local self_action="$3"
|
||||||
local tag="$4"
|
local tag="$4"
|
||||||
|
|
||||||
|
clear_runner_cache
|
||||||
|
|
||||||
local dir="$DIR/self"
|
local dir="$DIR/self"
|
||||||
git clone . $dir
|
git clone . $dir
|
||||||
(
|
(
|
||||||
|
|
|
@ -39,7 +39,7 @@ function run() {
|
||||||
docker run --restart unless-stopped --name ${CONTAINER} \
|
docker run --restart unless-stopped --name ${CONTAINER} \
|
||||||
-e "RUN_MODE=dev" \
|
-e "RUN_MODE=dev" \
|
||||||
-e "FORGEJO__security__INSTALL_LOCK=true" \
|
-e "FORGEJO__security__INSTALL_LOCK=true" \
|
||||||
-e "FORGEJO__log__LEVEL=debug" \
|
-e "FORGEJO__log__LEVEL=trace" \
|
||||||
-e "FORGEJO__actions__ENABLED=true" \
|
-e "FORGEJO__actions__ENABLED=true" \
|
||||||
-e "FORGEJO__queue__TYPE=immediate" \
|
-e "FORGEJO__queue__TYPE=immediate" \
|
||||||
-e "FORGEJO__queue.push_update__TYPE=immediate" \
|
-e "FORGEJO__queue.push_update__TYPE=immediate" \
|
||||||
|
|
Loading…
Reference in a new issue