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.
This commit is contained in:
Earl Warren 2023-10-12 15:47:32 +02:00
parent 9774672bc7
commit 87d8b85700
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 12 additions and 2 deletions

View file

@ -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)
}
"$@"

View file

@ -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
(

View file

@ -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" \