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 https://forgejo.org/docs/latest/admin/actions/
  • Go 87.2%
  • JavaScript 11.1%
  • Shell 1.3%
  • Makefile 0.3%
Find a file
Mathieu Fenniak 9ff65b1a72
All checks were successful
cascade / debug (push) Has been skipped
checks / Build Forgejo Runner (push) Successful in 40s
example / docker-build-push-action-in-lxc (push) Successful in 1m27s
checks / validate mocks (push) Successful in 43s
checks / validate pre-commit-hooks file (push) Successful in 39s
checks / runner exec tests (push) Successful in 39s
/ example-docker-compose (push) Successful in 2m40s
checks / Build unsupported platforms (push) Successful in 1m22s
/ example-on-demand (push) Successful in 4m25s
/ example-lxc-systemd (push) Successful in 7m42s
checks / Run integration tests with Docker (docker-latest) (push) Successful in 13m24s
cascade / forgejo (push) Successful in 44m29s
checks / Run integration tests with Docker (docker-stable) (push) Successful in 12m42s
checks / Run integration tests with Podman (push) Successful in 16m12s
refactor: clean-up error handling on task execution (#1400)
The goal I had in mind was to make sure that once the runner has a task from `FetchTask`, it never has any error cases that don't get reported back to the server.  I believe that's already practically the case, but I've applied a couple refactorings to clarify it:
- `Run()` no longer returns an error, to indicate that its expected to handle errors internally.  Nearly no code paths used this.
- `runningTasks` (the only code path using the above) had a possibility for a race condition which could allow two instances of the same task to be run, which was fixed up.
- `recover()` is used when running jobs in a way that would not report status back to the server.  But practically speaking these `recover()` blocks were never used because panics from within the job invocation [are also recovered](142689a39a/internal/app/run/runner.go (L231-L235)).

So, I think this just ends up as a refactor that removes some unused error handling, but it helps clarify that no error cases seem to exist that won't report status.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](#1400): <!--number 1400 --><!--line 0 --><!--description cmVmYWN0b3I6IGNsZWFuLXVwIGVycm9yIGhhbmRsaW5nIG9uIHRhc2sgZXhlY3V0aW9u-->refactor: clean-up error handling on task execution<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: #1400
Reviewed-by: Andreas Ahlenstorf <[email protected]>
Co-authored-by: Mathieu Fenniak <[email protected]>
Co-committed-by: Mathieu Fenniak <[email protected]>
2026-02-23 15:21:56 +00:00
.forgejo Revert "Replace Node.js with data.forgejo.org/oci/node 24-trixie (#1395)" (#1397) 2026-02-21 03:36:28 +00:00
act Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.10.1 (#1396) 2026-02-21 02:44:12 +00:00
contrib Restore contrib/forgejo-runner.service (#772) 2025-07-30 22:16:05 +00:00
examples fix: correct examples/docker-compose for create-runner-file behaviour change (#1402) 2026-02-23 15:21:41 +00:00
internal refactor: clean-up error handling on task execution (#1400) 2026-02-23 15:21:56 +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 fix: unbreak the build for platforms w/o docker support (#1294) 2026-01-14 20:20:05 +00: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/alpine Docker tag to v3.23 (#1288) 2026-01-14 16:12:06 +00:00
go.mod Update module github.com/go-git/go-git/v5 to v5.16.5 (#1365) 2026-02-10 02:59:35 +00:00
go.sum Update module github.com/go-git/go-git/v5 to v5.16.5 (#1365) 2026-02-10 02:59:35 +00:00
LICENSE chore: change the license to GPLv3-or-later (#773) 2025-09-04 09:26:12 +00:00
main.go fix: unrecoverable errors in artifactcache should have non-zero exit code (#1222) 2025-12-15 14:50:17 +00:00
Makefile Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.10.1 (#1396) 2026-02-21 02:44:12 +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): change name for lxc node version 2026-01-13 11:29:01 +01: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 [email protected] 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

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