document how to use build_runner for a short debug loop

This commit is contained in:
Earl Warren 2023-04-05 16:48:22 +02:00
parent 05c2b60cc5
commit 1862690dde
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 20 additions and 6 deletions

View file

@ -8,6 +8,14 @@ jobs:
set -x set -x
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19 ./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19
#
# Uncomment the following for a shortcut to debugging the Forgejo runner.
# It will build the runner from a designated repository and branch instead of
# downloading it from a canonical release.
#
# ./forgejo-test-helper.sh build_runner http://code.forgejo.org/forgejo/runner branch-under-debug
# export PATH=$(pwd)/forgejo-runner:$PATH
#
./forgejo-runner.sh setup ./forgejo-runner.sh setup
export FORGEJO_RUNNER_LOGS=forgejo-runner.log export FORGEJO_RUNNER_LOGS=forgejo-runner.log
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output ./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output

View file

@ -21,6 +21,11 @@ description: |
Create the repository `$forgejo/root/testrepo` and populate it with the Create the repository `$forgejo/root/testrepo` and populate it with the
content of the `testrepo` directory. The SHA of the tip of the repository content of the `testrepo` directory. The SHA of the tip of the repository
is in the output, starting with `sha=`. is in the output, starting with `sha=`.
* `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v1.4.1`
Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`.
`export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh`
will use this binary instead of downloading a released version of the runner.
If the version is not specified, build from the main branch.
The combination of `push_self_action` and `run_workflow` allows to The combination of `push_self_action` and `run_workflow` allows to
run Forgejo Actions workflows from `testrepo` that use the action run Forgejo Actions workflows from `testrepo` that use the action

View file

@ -21,22 +21,23 @@ function dependency_go() {
function checkout() { function checkout() {
local git="$1" local git="$1"
if ! test -d forgejo-runner ; then rm -fr forgejo-runner
git clone $git forgejo-runner git clone $git forgejo-runner
fi
} }
function build() { function build_runner() {
local git="$1" local git="$1"
local version="$2" local version="${2:-main}"
( (
checkout "$git" checkout "$git"
dependency_go
cd forgejo-runner cd forgejo-runner
git checkout "$version" git checkout "$version"
make build make build
export PATH=$PATH:$(pwd)
) )
export PATH=$PATH:$(pwd)/forgejo-runner
forgejo-runner --version
} }
function api() { function api() {