1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-30 19:22:09 +00:00
forgejo-runner/examples/lxc-systemd
Renovate Bot aed4dd8766
Update forgejo-runner to v11.1.1 (#1018)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | minor | `11.0.0` -> `11.1.1` |
| [forgejo/runner](https://code.forgejo.org/forgejo/runner) | minor | `11.0.0` -> `11.1.1` |

---

### Release Notes

<details>
<summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary>

### [`v11.1.1`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.1.1)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v11.1.0...v11.1.1)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1017): <!--number 1017 --><!--line 0 --><!--description Zml4OiBvdXRwdXRzIGFyZSBvbmx5IHNldCB3aGVuIHRoZSBqb2IgaXMgc3VjY2Vzc2Z1bA==-->fix: outputs are only set when the job is successful<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1015): <!--number 1015 --><!--line 0 --><!--description Zml4KHByZS1jb21taXQpOiBkb27igJl0IGRlZmF1bHQgYHZlcmJvc2VgIHRvIG9u-->fix(pre-commit): don’t default `verbose` to on<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1013): <!--number 1013 --><!--line 0 --><!--description Y2hvcmU6IGRvY3VtZW50IHRoYXQgRE9DS0VSX0hPU1Qgc2hvdWxkIGJlIHVzZWQgaW5zdGVhZCBvZiAtLWNvbnRhaW5lci1kYWVtb24tc29ja2V0-->chore: document that DOCKER\_HOST should be used instead of --container-daemon-socket<!--description-->

<!--end release-notes-assistant-->

### [`v11.1.0`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.1.0)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v11.0.0...v11.1.0)

> **Warning** Upgrade to v11.1.1 instead. A [regression was found](https://code.forgejo.org/forgejo/runner/issues/1016) that crashed the runner on skipped or failed jobs.

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1002): <!--number 1002 --><!--line 0 --><!--description ZmVhdDogYWRkIHByZS1jb21taXQgaG9vayBmb3IgdmFsaWRhdG9y-->feat: add pre-commit hook for validator<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1008): <!--number 1008 --><!--line 0 --><!--description ZmVhdDogdmFsaWRhdGUgLS1kaXJlY3RvcnkgYWx0ZXJuYXRpdmUgdG8gLS1yZXBvc2l0b3J5IHRvIG5vdCBjbG9uZQ==-->feat: validate --directory alternative to --repository to not clone<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/999): <!--number 999 --><!--line 0 --><!--description ZmVhdDogdGhlIGZvcmdlam8gY29udGV4dCBpcyBlcXVpdmFsZW50IHRvIHRoZSBnaXRodWIgY29udGV4dA==-->feat: the forgejo context is equivalent to the github context<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/997): <!--number 997 --><!--line 0 --><!--description ZmVhdDogYWRkIHN1cHBvcnQgZm9yIGEgRGViaWFuIEdOVS9MaW51eCBMWEMgYmFja2VuZCBiYXNlZCBvbiB0cml4aWUgKGUuZy4gdHJpeGllLWx4YzpseGM6Ly9kZWJpYW46dHJpeGllKQ==-->feat: add support for a Debian GNU/Linux LXC backend based on trixie (e.g. trixie-lxc:lxc://debian:trixie)<!--description-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1012): <!--number 1012 --><!--line 0 --><!--description Zml4OiBzY2hlbWEgdmFsaWRhdGlvbiBtdXN0IGFjY2VwdCBhbGlhc2VzIGFuZCBtZXJnZXM=-->fix: schema validation must accept aliases and merges<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1009): <!--number 1009 --><!--line 0 --><!--description Zml4OiBmb3JnZWpvLXJ1bm5lciB2YWxpZGF0ZSBleGl0IHdpdGggZXJyb3Igd2hlbiB2YWxpZGF0aW9uIGZhaWxz-->fix: forgejo-runner validate exit with error when validation fails<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1006): <!--number 1006 --><!--line 0 --><!--description Zml4OiBkbyBub3Qgc2F2ZSAucnVubmVyIHVubGVzcyBpdCBpcyBtb2RpZmllZA==-->fix: do not save .runner unless it is modified<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1003): <!--number 1003 --><!--line 0 --><!--description Zml4OiByZW1vdmUgTFhDIHdvcmtpbmcgZGlyZWN0b3J5IHdoZW4gaXQgY29tcGxldGVz-->fix: remove LXC working directory when it completes<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/995): <!--number 995 --><!--line 0 --><!--description Zml4OiBzZW5kIGpvYiBvdXRwdXRzICYgam9iIHJlc3VsdCB0byBGb3JnZWpvIGluIHN5bmMgd2l0aCBlYWNoIG90aGVy-->fix: send job outputs & job result to Forgejo in sync with each other<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/986): <!--number 986 --><!--line 0 --><!--description Zml4OiBpZiB0aGUgRm9yZ2VqbyBpbnN0YW5jZSBmYWlsZWQgYSBqb2IsIGNhbmNlbCBpdA==-->fix: if the Forgejo instance failed a job, cancel it<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/982): <!--number 982 --><!--line 0 --><!--description Zml4OiBlbmZvcmNlIGpvYi48am9iLWlkPi50aW1lb3V0LW1pbnV0ZXM=-->fix: enforce job.<job-id>.timeout-minutes<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/972): <!--number 972 --><!--line 0 --><!--description Zml4OiB1c2UgYSBmaXhlZCBydW5uZXIgbmFtZSBmb3Igb2xkICg8PSB2MS4yMCkgRm9yZ2VqbyBpbnN0YW5jZXM=-->fix: use a fixed runner name for old (<= v1.20) Forgejo instances<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/965): <!--number 965 --><!--line 0 --><!--description Zml4OiBkb2NrZXItY29tcG9zZSBleGFtcGxlOiBhbGxvdyB0aGUgcnVubmVyIHRvIGtlZXAgaXRzIGxhYmVscw==-->fix: docker-compose example: allow the runner to keep its labels<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1001): <!--number 1001 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9seGMtaGVscGVycyB0byB2MS4xLjA=-->Update dependency forgejo/lxc-helpers to v1.1.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1000): <!--number 1000 --><!--line 0 --><!--description Y2hvcmU6IG1pbmltYWwgaW50ZWdyYXRpb24gdGVzdCBmb3IgdGhlIExYQyBiYWNrZW5k-->chore: minimal integration test for the LXC backend<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/993): <!--number 993 --><!--line 0 --><!--description Y2hvcmU6IHVuaWZ5IGFjdGlvbnMgVVJMcyBpbiAuZm9yZ2Vqby93b3JrZmxvd3M=-->chore: unify actions URLs in .forgejo/workflows<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/992): <!--number 992 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL2Nhc2NhZGluZy1wciBhY3Rpb24gdG8gdjIuMy4w-->Update <https://data.forgejo.org/actions/cascading-pr> action to v2.3.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/990): <!--number 990 --><!--line 0 --><!--description Y2hvcmU6IGRhdGEuZm9yZ2Vqby5vcmcvYWN0aW9ucy9jYXNjYWRpbmctcHIgaXMgdGhlIGNhbm9uaWNhbCBsb2NhdGlvbg==-->chore: data.forgejo.org/actions/cascading-pr is the canonical location<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/989): <!--number 989 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9yZWxlYXNlLW5vdGVzLWFzc2lzdGFudCB0byB2MS40LjE=-->Update dependency forgejo/release-notes-assistant to v1.4.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/988): <!--number 988 --><!--line 0 --><!--description Y2hvcmU6IHdhaXQgNCB0aW1lcyBsb25nZXIgZm9yIHRoZSBmb3JnZWpvIGNhc2NhZGUgcHVsbCByZXF1ZXN0IHRvIGNvbXBsZXRl-->chore: wait 4 times longer for the forgejo cascade pull request to complete<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/985): <!--number 985 --><!--line 0 --><!--description UmVtb3ZlIHdpbmRvd3MgYnVpbGQvdGVzdCBwaXBlbGluZSBmb3IgR2l0SHVi-->Remove windows build/test pipeline for GitHub<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/981): <!--number 981 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBjb2RlLmZvcmdlam8ub3JnL2Zvcmdlam8vYWN0aW9ucy1wcm90byB0byB2MC41LjI=-->Update module code.forgejo.org/forgejo/actions-proto to v0.5.2<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/969): <!--number 969 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL3NldHVwLWZvcmdlam8gYWN0aW9uIHRvIHYzLjAuMw==-->Update <https://data.forgejo.org/actions/setup-forgejo> action to v3.0.3<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/975): <!--number 975 --><!--line 0 --><!--description VXBkYXRlIGZvcmdlam8tcnVubmVyIHRvIHYxMSAobWFqb3Ip-->Update forgejo-runner to v11 (major)<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/973): <!--number 973 --><!--line 0 --><!--description Y2k6IHVwZGF0ZSBmb3JnZWpvIHZlcnNpb24gZm9yIHJlbGVhc2UgaW50ZWdyYXRpb24=-->ci: update forgejo version for release integration<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/970): <!--number 970 --><!--line 0 --><!--description Y2hvcmU6IGx4Yy1zeXN0ZW1kIG1heSBuZWVkIG1vcmUgdGltZSB0byBzdGFydCBvbiBzbG93IG1hY2hpbmVz-->chore: lxc-systemd may need more time to start on slow machines<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/966): <!--number 966 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb2xhbmcub3JnL3gvdGVybSB0byB2MC4zNS4w-->Update module golang.org/x/term to v0.35.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/964): <!--number 964 --><!--line 0 --><!--description Y2hvcmU6IGNhbGwgdGhlIHJlbGVhc2Ugbm90ZXMgYXNzaXN0YW50IHdoZW4gb3BlbmluZyBhIG5ldyBwdWxsIHJlcXVlc3Q=-->chore: call the release notes assistant when opening a new pull request<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/954): <!--number 954 --><!--line 0 --><!--description Y2hvcmU6IHNraXAgcmVsZWFzZS1ub3Rlcy1hc3Npc3RhbnQgZm9yIGRlcGVuZGVuY3kgdXBkYXRlcw==-->chore: skip release-notes-assistant for dependency updates<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1018
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-19 04:31:14 +00:00
..
forgejo-runner-service.sh Update forgejo-runner to v11.1.1 (#1018) 2025-09-19 04:31:14 +00:00
README.md fix: lxc-systemd example: export INPUTS_SERIAL (#943) 2025-09-06 17:19:13 +00:00

forgejo-runner-service.sh installs a Forgejo runner within an LXC container and runs it from a systemd service.

Quickstart

  • Install: sudo wget -O /usr/local/bin/forgejo-runner-service.sh https://code.forgejo.org/forgejo/runner/raw/branch/main/examples/lxc-systemd/forgejo-runner-service.sh && sudo chmod +x /usr/local/bin/forgejo-runner-service.sh
  • Obtain a runner registration token ($TOKEN)
  • Choose a serial number that is not already in use in /etc/forgejo-runner
  • Create a runner export INPUTS_SERIAL=30 ; INPUTS_TOKEN=$TOKEN INPUTS_FORGEJO=https://code.forgejo.org forgejo-runner-service.sh
  • Start systemctl enable --now forgejo-runner@$INPUTS_SERIAL
  • Monitor with:
    • systemctl status forgejo-runner@$INPUTS_SERIAL
    • tail --follow=name /var/log/forgejo-runner/$INPUTS_SERIAL.log

Installation or upgrade

Installation

  • sudo wget -O /usr/local/bin/forgejo-runner-service.sh https://code.forgejo.org/forgejo/runner/raw/branch/main/examples/lxc-systemd/forgejo-runner-service.sh && sudo chmod +x /usr/local/bin/forgejo-runner-service.sh

Upgrade

Warning

runners will not be upgraded immediately, the upgrade will happen when they restart (at $INPUTS_LIFETIME intervals).

The following will be upgraded:

  • forgejo-runner-service.sh will replace itself with the script found at the provided URL (e.g. https://code.forgejo.org/forgejo/runner/src/tag/v6.3.1/examples/lxc-systemd/forgejo-runner-service.sh)
  • lxc-helpers*.sh will be replaced with the version pinned in forgejo-runner-service.sh
  • forgejo-runner-X.Y.Z will default to the version hardcoded in forgejo-runner-service.sh

Example:

  • forgejo-runner-service.sh upgrade https://code.forgejo.org/forgejo/runner/src/tag/v6.3.1/examples/lxc-systemd/forgejo-runner-service.sh

Description

  • Each runner is assigned a unique serial number ($INPUTS_SERIAL)
  • The configuration is in /etc/forgejo-runner/$INPUTS_SERIAL
  • The environment variables are in /etc/forgejo-runner/$INPUTS_SERIAL/env
  • The cache is in /var/lib/forgejo-runner/runner-$INPUTS_SERIAL
  • The systemd service unit is forgejo-runner@$INPUTS_SERIAL
  • The logs of the runner daemon are in /var/log/forgejo-runner/$INPUTS_SERIAL.log

How it works

  • Creating a runner (for instance with INPUTS_SERIAL=30 INPUTS_TOKEN=$TOKEN INPUTS_FORGEJO=https://code.forgejo.org forgejo-runner-service.sh) will:
    • use $INPUTS_TOKEN to register on $INPUTS_FORGEJO and save the result in the /etc/forgejo-runner/$INPUTS_SERIAL/.runner file
    • generate a default configuration file in the /etc/forgejo-runner/$INPUTS_SERIAL/config.yml file which can then be manually edited
  • Each runner is launched in a dedicated LXC container named runner-$INPUTS_SERIAL-lxc with the following bind mounts:
    • /etc/forgejo-runner/$INPUTS_SERIAL
    • /var/lib/forgejo-runner/runner-$INPUTS_SERIAL/.cache/actcache
  • systemctl start forgejo-runner@$INPUTS_SERIAL will do the following when it starts and every $INPUTS_LIFETIME interval after that:
    • attempt to gracefully stop (SIGTERM) the runner, waiting for all jobs to complete
    • forcibly kill the runner if it does not stop within 6h
    • shutdown the LXC container and delete it (the volumes bind mounted are preserved)
    • create a brand new LXC container (with the specified $INPUTS_LXC_CONFIG)
    • install and run a Forgejo runner daemon in the LXC container using /etc/forgejo-runner/$INPUTS_SERIAL/config.yml
    • redirect the output of the runner to /var/log/forgejo-runner/$INPUTS_SERIAL.log
  • systemctl stop forgejo-runner@$INPUTS_SERIAL will stop the runner but keep the LXC container running

Creation

The creation of a new runner is driven by the following environment variables:

  • INPUTS_SERIAL: unique number in the range [10-100] (check /etc/forgejo-runner)
  • INPUTS_TOKEN: a runner registration token obtained from the web UI
  • INPUTS_FORGEJO: the Forgejo instance from which INPUTS_TOKEN was obtained (e.g. https://code.forgejo.org)
  • INPUTS_RUNNER_VERSION: the version of the Forgejo runner as found in https://code.forgejo.org/forgejo/runner/releases (e.g. 9.0.2)
  • INPUTS_LXC_CONFIG: the value of the --config argument of lxc-helpers used when creating the LXC container for the runner (e.g. docker)
  • INPUTS_LIFETIME: the LXC container is re-created when its lifetime expires (e.g. 7d)

Hacking

  • An existing LXC configuration will not be modified. If lxc-ls exists, it is assumed that LXC is configured and ready to be used.
  • Migrating an existing runner:
    serial=10
    mkdir /etc/forgejo-runner/$serial
    cp .runner config.yml /etc/forgejo-runner/$serial
    INPUTS_SERIAL=$serial INPUTS_FORGEJO=https://code.forgejo.org forgejo-runner-service.sh
    systemctl status forgejo-runner@$serial
    
  • Set debug by adding VERBOSE=true in /etc/forgejo-runner/$INPUTS_SERIAL/env

Use a specific version of the Forgejo runner

The goal is that a LXC container uses a version of the Forgejo runner that is different from the default. It needs to be installed and pinned.

  • Install: INPUTS_RUNNER_VERSION=9.0.2 forgejo-runner-service.sh install_runner
  • Pin the version in /etc/forgejo-runner/N/env (e.g. INPUTS_RUNNER_VERSION=9.0.2)