9
2
Fork
You've already forked runner
0
Builds of the Forgejo Runner for use on Zig Software Foundation machines. https://code.forgejo.org/forgejo/runner
Go 84.3%
JavaScript 13.6%
Shell 1.5%
Makefile 0.4%
Dockerfile 0.1%
Matthew Lugg 90d0b4bef3 feat: run host child processes in groups ( #1184 )
This means process groups on POSIX and "job objects" on Windows. The
idea is that if the command gets cancelled (e.g. due to an Actions job
being cancelled), we need to terminate the entire process tree, not
just the root process.
This missing feature was the cause of forgejo/runner#1038. On POSIX
platforms, cancellation worked essentially by luck: programs tend to
terminate on SIGHUP (that being the default action for that signal), so
when the root process was killed, all of its children would receive
SIGHUP due to losing their controlling TTY and terminate. However, a
program *could* of course handle this signal or detach from the TTY, in
which case cancelation would previously fail to terminate them.
This patch has been tested on both Windows and Linux on the Zig
project's CI runners. Jobs were able to start normally, and could be
cancelled immediately, with no orphaned processes.
Resolves: forgejo/runner#1038
---
I wasn't sure whether to put this here or under windows/runner; the logic
affects all targets, but it's most significant on Windows. Let me know if I
should re-open this over there.
In any case, this is essentially achieving the same thing as windows/runner#2.
However, I believe this is a better patch: the other one is LLM-written, and appears
buggy and quite overcomplicated; plus, unlike this commit, it does not address the
(admittedly much less problematic) issue on POSIX targets.
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
 - [PR](https://code.forgejo.org/forgejo/runner/pulls/1184): <!--number 1184 --><!--line 0 --><!--description ZmVhdDogcnVuIGhvc3QgY2hpbGQgcHJvY2Vzc2VzIGluIGdyb3Vwcw==-->feat: run host child processes in groups<!--description-->
<!--end release-notes-assistant-->
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1184
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
Co-committed-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025年11月28日 15:46:18 +00:00
.forgejo Add example that demonstrates on demand runners ( #1172 ) 2025年11月28日 15:45:37 +00:00
act feat: run host child processes in groups ( #1184 ) 2025年11月28日 15:46:18 +00:00
contrib Restore contrib/forgejo-runner.service ( #772 ) 2025年07月30日 22:16:05 +00:00
examples Add example that demonstrates on demand runners ( #1172 ) 2025年11月28日 15:45:37 +00:00
internal fix: forge.run_attempt is always 1 ( #1185 ) 2025年11月24日 16:21:40 +00:00
release-notes feat: add the runner validate subcommand ( #757 ) 2025年07月31日 05:37:12 +00:00
testutils feat: add the runner validate subcommand ( #757 ) 2025年07月31日 05:37:12 +00:00
.dockerignore [FORGEJO] build forgejo-runner 2023年08月23日 14:44:47 +02:00
.editorconfig Add .editorconfig and .gitattributes ( #186 ) 2023年05月13日 23:51:22 +08:00
.gitattributes Add .editorconfig and .gitattributes ( #186 ) 2023年05月13日 23:51:22 +08:00
.gitignore chore: remove unused code and comments including gitea 2025年07月03日 18:58:11 +02:00
.golangci.yml test: run lint-check during CI, add forbidigo, cleanup linter exclusions ( #1181 ) 2025年11月23日 15:01:52 +00:00
.pre-commit-hooks.yaml fix(pre-commit): don’t default verbose to on ( #1015 ) 2025年09月18日 12:02:07 +00:00
Dockerfile Update data.forgejo.org/oci/golang Docker tag to v1.25 ( #1110 ) 2025年10月24日 06:37:56 +00:00
go.mod chore: bump version to v12 ( #1176 ) 2025年11月22日 16:25:20 +00:00
go.sum Update golang.org/x/crypto (indirect) to v0.45.0 [SECURITY] ( #1168 ) 2025年11月20日 22:54:27 +00:00
LICENSE chore: change the license to GPLv3-or-later ( #773 ) 2025年09月04日 09:26:12 +00:00
main.go chore: bump version to v12 ( #1176 ) 2025年11月22日 16:25:20 +00:00
Makefile chore: bump version to v12 ( #1176 ) 2025年11月22日 16:25:20 +00:00
README.md chore: change the license to GPLv3-or-later ( #773 ) 2025年09月04日 09:26:12 +00:00
RELEASE-NOTES.md chore: release notes are now published together with the release ( #775 ) 2025年07月31日 08:02:20 +00:00
renovate.json chore(renovate): group runner updates 2025年09月10日 09:51:22 +02:00

Forgejo Runner

A daemon that connects to a Forgejo instance and runs jobs for continuous integration. The installation and usage instructions are part of the Forgejo documentation.

Reporting security-related issues

Sensitive security-related issues should be reported to security@forgejo.org using encryption.

License

The Forgejo runner is distributed under the terms of the GPL version 3.0 or any later version.

Architectures & OS

The Forgejo runner is supported and tested on amd64 and arm64 (binaries and containers) on Operating Systems based on the Linux kernel.

Work may be in progress for other architectures and you can browse the corresponding issues to figure out how they make progress. If you are interested in helping them move forward, open an issue. The most challenging part is to setup and maintain a native runner long term. Once it is supported by Forgejo, the runner is expected to be available 24/7 which can be challenging. Otherwise debugging any architecture specific problem won't be possible.

Hacking

The Forgejo runner is a dependency of the setup-forgejo action. See the full dependency graph for a global view.

Building

  • Install Go and make(1)
  • make build

Linting

  • make lint-check
  • make lint # will fix some lint errors

Testing

The workflow that runs in the CI uses similar commands.

Without a Forgejo instance

  • Install Docker
  • make test integration-test

The TestRunner_RunEvent test suite contains most integration tests with real-world workflows and is time-consuming to run. During development, it is helpful to run a specific test through a targeted command such as this:

  • go test -count=1 -run='TestRunner_RunEvent$/local-action-dockerfile$' ./act/runner

With a Forgejo instance

  • Run a Forgejo instance locally (for instance at http://0.0.0.0:8080) and create as shared secret
export FORGEJO_RUNNER_SECRET='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
export FORGEJO_URL=http://0.0.0.0:8080
forgejo forgejo-cli actions register --labels docker --name therunner --secret $FORGEJO_RUNNER_SECRET
  • make test integration-test # which will run addional tests because FORGEJO_URL is set

end-to-end

  • Follow the instructions from the end-to-end tests to run actions tests locally.
  • ./end-to-end.sh actions_teardown # stop the Forgejo and runner daemons running in the end-to-end environment
  • ( cd ~/clone-of-the-runner-repo ; make build ; cp forgejo-runner /tmp/forgejo-end-to-end/forgejo-runner ) # install the runner built from sources
  • ./end-to-end.sh actions_setup 13.0 # start Forgejo v13.0 and the runner daemon in the end-to-end environment
  • ./end-to-end.sh actions_verify_example echo # run the echo workflow
  • xdg-open http://127.0.0.1:3000/root/example-echo/actions/runs/1 # see the logs workflow
  • less /tmp/forgejo-end-to-end/forgejo-runner.log # analyze the runner logs
  • less /tmp/forgejo-end-to-end/forgejo-work-path/log/forgejo.log # analyze the Forgejo logs