From 65e3fafd02990b4614d50049e1bf1bfbd41a28e1 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 12 Jan 2025 08:05:37 +0100 Subject: [PATCH 1/2] actions: force-rebuild must use a copy of the repository it may not have permission to write on the repository itself, nor should it. --- actions/example-force-rebuild/run.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/actions/example-force-rebuild/run.sh b/actions/example-force-rebuild/run.sh index 2f2cb7e..d82890a 100755 --- a/actions/example-force-rebuild/run.sh +++ b/actions/example-force-rebuild/run.sh @@ -1,3 +1,7 @@ +TMPDIR=$(mktemp -d) + +trap "rm -fr $TMPDIR" EXIT + function setup_with_rebuild() { FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config-with-rebuild.yml forgejo-runner.sh reload } @@ -7,28 +11,32 @@ function setup_without_rebuild() { } function run() { - local expected="$1" + local dir="$1" + local expected="$2" local repo=root/example-$example - forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token + forgejo-test-helper.sh push_workflow $dir $url root example-$example setup-forgejo $token sha=$(forgejo-test-helper.sh branch_tip $url $repo main) forgejo-test-helper.sh wait_$expected $url $repo $sha } function main() { + local dir=$TMPDIR/repository + cp -a $EXAMPLE_DIR $dir + # set up passing docker action - echo "0" > $EXAMPLE_DIR/.forgejo/local-docker-action/input.txt + echo "0" >$dir/.forgejo/local-docker-action/input.txt setup_with_rebuild - run success + run $dir success # change docker action to fail - echo "1" > $EXAMPLE_DIR/.forgejo/local-docker-action/input.txt + echo "1" >$dir/.forgejo/local-docker-action/input.txt # ... but without a rebuild, it should still pass setup_without_rebuild - run success + run $dir success # now the action should fail setup_with_rebuild - run failure + run $dir failure } main From adb09f901bbeb89661e5f44daacb151687d875aa Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 12 Jan 2025 08:07:07 +0100 Subject: [PATCH 2/2] actions: force-rebuild use code.forgejo.org/oci to avoid throttling --- .../.forgejo/local-docker-action/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/example-force-rebuild/.forgejo/local-docker-action/Dockerfile b/actions/example-force-rebuild/.forgejo/local-docker-action/Dockerfile index 23e027e..2339a39 100644 --- a/actions/example-force-rebuild/.forgejo/local-docker-action/Dockerfile +++ b/actions/example-force-rebuild/.forgejo/local-docker-action/Dockerfile @@ -1,5 +1,5 @@ -FROM debian:bookworm-slim +FROM code.forgejo.org/oci/debian:bookworm COPY entrypoint.sh /run/entrypoint.sh # if we rebuild, we should notice this file change COPY input.txt /run/input.txt -ENTRYPOINT [ "/run/entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "/run/entrypoint.sh" ]