end-to-end/actions/example-force-rebuild/run.sh
gratux dbe50bffc7 add test for force_rebuild (#448)
see also [forgejo/runner #406](https://code.forgejo.org/forgejo/runner/pulls/406)

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/448
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: gratux <gratux@noreply.code.forgejo.org>
Co-committed-by: gratux <gratux@noreply.code.forgejo.org>
2025-01-11 15:27:44 +00:00

34 lines
1,019 B
Bash
Executable file

function setup_with_rebuild() {
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config-with-rebuild.yml forgejo-runner.sh reload
}
function setup_without_rebuild() {
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config-without-rebuild.yml forgejo-runner.sh reload
}
function run() {
local expected="$1"
local repo=root/example-$example
forgejo-test-helper.sh push_workflow actions/example-$example $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() {
# set up passing docker action
echo "0" > $EXAMPLE_DIR/.forgejo/local-docker-action/input.txt
setup_with_rebuild
run success
# change docker action to fail
echo "1" > $EXAMPLE_DIR/.forgejo/local-docker-action/input.txt
# ... but without a rebuild, it should still pass
setup_without_rebuild
run success
# now the action should fail
setup_with_rebuild
run failure
}
main