diff --git a/actions/example-schedule-noncancel/.forgejo/workflows/schedule_continue.yml b/actions/example-schedule-noncancel/.forgejo/workflows/schedule_continue.yml index 8fe7177..58156ea 100644 --- a/actions/example-schedule-noncancel/.forgejo/workflows/schedule_continue.yml +++ b/actions/example-schedule-noncancel/.forgejo/workflows/schedule_continue.yml @@ -6,7 +6,8 @@ jobs: runs-on: docker container: image: code.forgejo.org/oci/debian:bookworm - options: "--volume /srv/example:/srv/example" + volumes: + - /srv/example:/srv/example steps: - run: | while ! [ -f /srv/example/schedule-noncancel/PUSHED ]; do diff --git a/actions/example-schedule-noncancel/run.sh b/actions/example-schedule-noncancel/run.sh index 810e634..b3756bf 100755 --- a/actions/example-schedule-noncancel/run.sh +++ b/actions/example-schedule-noncancel/run.sh @@ -12,20 +12,20 @@ fi # forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token -# Prevent test failure because the db is occupied -sqlite3 $DIR/forgejo-work-path/forgejo.db "pragma busy_timeout=20000" - # # get the run id of the workflow that just started # getScheduleRun() { - sqlite3 $DIR/forgejo-work-path/forgejo.db \ - "select action_run.id \ + rm -f $DIR/forgejo-work-path/forgejo.copy.db + cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db + sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \ + "pragma busy_timeout = 5000; \ + select action_run.id \ from action_run \ inner join action_schedule on action_run.schedule_id = action_schedule.id \ inner join repository on action_schedule.repo_id = repository.id \ where repository.name = 'example-schedule-noncancel' \ - order by action_run.created desc limit 1" + order by action_run.created desc limit 1" | sed '2q;d' } run_id=$(getScheduleRun) @@ -41,11 +41,14 @@ echo Schedule run id: $run_id # Wait for it to be started # checkStarted() { - sqlite3 $DIR/forgejo-work-path/forgejo.db \ - "select id \ + rm -f $DIR/forgejo-work-path/forgejo.copy.db + cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db + sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \ + "pragma busy_timeout = 5000; \ + select id \ from action_run \ where id = $run_id \ - and started is not null" + and started is not null" | sed '2q;d' } started_check=$(checkStarted) @@ -73,11 +76,14 @@ touch /srv/example/schedule-noncancel/PUSHED echo Wait for workflow to finish checkFinished() { - sqlite3 $DIR/forgejo-work-path/forgejo.db \ - "select status \ + rm -f $DIR/forgejo-work-path/forgejo.copy.db + cp $DIR/forgejo-work-path/forgejo.db $DIR/forgejo-work-path/forgejo.copy.db + sqlite3 $DIR/forgejo-work-path/forgejo.copy.db \ + "pragma busy_timeout = 5000; \ + select status \ from action_run \ where id = $run_id \ - and (status != 6 and status != 5)" + and (status != 6 and status != 5)" | sed '2q;d' } finished_status=$(checkFinished) @@ -88,5 +94,6 @@ while [ -z $finished_status ]; do done echo Workflow finished. +rm -f $DIR/forgejo-work-path/forgejo.copy.db test $finished_status = 1