From 87d8b857000e5b885362c492005f38996c554e36 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 12 Oct 2023 15:47:32 +0200 Subject: [PATCH] cleanup the runner cache when uploading self action if the cache is not cleared, the action that was just uploaded with the latest changes won't be used, the cached version will. --- forgejo-runner.sh | 4 +++- forgejo-test-helper.sh | 8 ++++++++ forgejo.sh | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/forgejo-runner.sh b/forgejo-runner.sh index 8e995a7..21166bf 100755 --- a/forgejo-runner.sh +++ b/forgejo-runner.sh @@ -27,6 +27,7 @@ function download() { function register() { local forgejo="$1" + mktemp -d > forgejo-runner-home 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 } @@ -34,7 +35,7 @@ function register() { function run() { rm -f forgejo-runner.log 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 -- \ forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon sleep 1 @@ -78,6 +79,7 @@ function stop_daemon() { function teardown() { stop_daemon forgejo-runner + rm -fr $(cat forgejo-runner-home) } "$@" diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index a6bec88..0ae8c51 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -174,12 +174,20 @@ function run_workflow() { 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() { local url="$1" local owner="$2" local self_action="$3" local tag="$4" + clear_runner_cache + local dir="$DIR/self" git clone . $dir ( diff --git a/forgejo.sh b/forgejo.sh index 19c1509..a54d90f 100755 --- a/forgejo.sh +++ b/forgejo.sh @@ -39,7 +39,7 @@ function run() { docker run --restart unless-stopped --name ${CONTAINER} \ -e "RUN_MODE=dev" \ -e "FORGEJO__security__INSTALL_LOCK=true" \ - -e "FORGEJO__log__LEVEL=debug" \ + -e "FORGEJO__log__LEVEL=trace" \ -e "FORGEJO__actions__ENABLED=true" \ -e "FORGEJO__queue__TYPE=immediate" \ -e "FORGEJO__queue.push_update__TYPE=immediate" \