Add a Forgejo Actions runner, to run CI for impress #1

Merged
matchu merged 2 commits from armin-bot/openneo-code:claude/actions-runner into main 2026-11-08 19:32:14 -08:00
Contributor

Sets up a Forgejo Actions runner on code.openneo.net, so OpenNeo/impress can run its test suite on every PR. The impress side, a .forgejo/workflows/test.yml, comes as a separate PR once this is live.

What it does

setup-actions.yml, also added to setup-all.yml:

  • Installs Docker and forgejo-runner v13.2.1 (checksum-pinned), running as a runner user under its own systemd service.
  • Registers the runner offline, with a shared secret, scoped to OpenNeo/impress only. Other repos, including forks and users' own repos, can't send it jobs.
  • Runs one job at a time, in containers capped at 1GB of memory each, with a 30-minute job timeout.
  • Keeps the security-sensitive container settings at their safe defaults, written out explicitly: no Docker socket, no host volumes, no privileged mode, and a fresh isolated network for each job.
  • Adds a 2GB swap file. Forgejo already uses about half this machine's 2GB of RAM, and a CI run peaks around 600MB.
  • Prunes unused Docker data weekly, since this disk has filled up before. It doesn't use -a, so the Ruby and MariaDB images stay cached.

app.ini gets an explicit [actions] section. Actions has been on by default since v1.21; the section also shortens log retention to 90 days and artifact retention to 30.

How secrets work

  • Fork PRs (from armin-bot, dice) need someone with write access to approve their first run ("Approve always" trusts that author from then on), and they never receive repo secrets.
  • Anyone with write access to OpenNeo/impress can push a branch with a workflow that reads secrets. Branch protection doesn't prevent that, and Forgejo has no environment-scoped secrets. So the boundary for future deploy secrets is "who can push to OpenNeo/impress", and contributors should stay fork-only.

To roll out

  1. Generate the runner secret:
    openssl rand -hex 20 > files/runner-secret/runner_secret
    
  2. Push the app.ini change (this restarts Forgejo) and set up the runner:
    ansible-playbook setup-forgejo.yml setup-actions.yml
    
  3. Turn on Actions for OpenNeo/impress: Settings → Units → Actions. It's currently the only thing switched off.
  4. Check that the runner shows up as idle under OpenNeo/impress → Settings → Actions → Runners.

Testing

  • ansible-playbook --syntax-check passes.
  • CLI flags and config keys are checked against Forgejo v17.0 and runner v13.2.1 source.
  • Not yet run against the real box, so the first run may need a small fix.
  • A fresh-eyes review caught a real bug, now fixed: without --keep-labels, re-running the playbook wiped the runner's labels, and jobs would stall until the runner restarted.
  • The impress workflow's steps were simulated in a clean checkout of upstream main: 406 examples, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ

Sets up a Forgejo Actions runner on code.openneo.net, so OpenNeo/impress can run its test suite on every PR. The impress side, a `.forgejo/workflows/test.yml`, comes as a separate PR once this is live. ## What it does `setup-actions.yml`, also added to `setup-all.yml`: - **Installs Docker and forgejo-runner v13.2.1** (checksum-pinned), running as a `runner` user under its own systemd service. - **Registers the runner offline**, with a shared secret, **scoped to OpenNeo/impress only**. Other repos, including forks and users' own repos, can't send it jobs. - **Runs one job at a time**, in containers capped at 1GB of memory each, with a 30-minute job timeout. - **Keeps the security-sensitive container settings at their safe defaults**, written out explicitly: no Docker socket, no host volumes, no privileged mode, and a fresh isolated network for each job. - **Adds a 2GB swap file.** Forgejo already uses about half this machine's 2GB of RAM, and a CI run peaks around 600MB. - **Prunes unused Docker data weekly**, since this disk has filled up before. It doesn't use `-a`, so the Ruby and MariaDB images stay cached. `app.ini` gets an explicit `[actions]` section. Actions has been on by default since v1.21; the section also shortens log retention to 90 days and artifact retention to 30. ## How secrets work - Fork PRs (from `armin-bot`, `dice`) need someone with write access to approve their first run ("Approve always" trusts that author from then on), and they **never** receive repo secrets. - Anyone with **write access to OpenNeo/impress** can push a branch with a workflow that reads secrets. Branch protection doesn't prevent that, and Forgejo has no environment-scoped secrets. So the boundary for future deploy secrets is "who can push to OpenNeo/impress", and contributors should stay fork-only. ## To roll out 1. Generate the runner secret: ```bash openssl rand -hex 20 > files/runner-secret/runner_secret ``` 2. Push the `app.ini` change (this restarts Forgejo) and set up the runner: ```bash ansible-playbook setup-forgejo.yml setup-actions.yml ``` 3. Turn on Actions for OpenNeo/impress: Settings → Units → Actions. It's currently the only thing switched off. 4. Check that the runner shows up as idle under OpenNeo/impress → Settings → Actions → Runners. ## Testing - `ansible-playbook --syntax-check` passes. - CLI flags and config keys are checked against Forgejo v17.0 and runner v13.2.1 source. - **Not yet run against the real box**, so the first run may need a small fix. - A fresh-eyes review caught a real bug, now fixed: without `--keep-labels`, re-running the playbook wiped the runner's labels, and jobs would stall until the runner restarted. - The impress workflow's steps were simulated in a clean checkout of upstream `main`: 406 examples, 0 failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ
Adds setup-actions.yml, which sets up a Forgejo Runner on this machine.
It runs jobs for OpenNeo/impress in Docker containers, one at a time:

- Registers the runner offline with a shared secret (a new
  files/secrets/runner_secret), scoped to OpenNeo/impress only.
- Keeps the security-sensitive container settings at their safe
  defaults, written out explicitly: no Docker socket, no host volumes,
  no privileged mode, and an isolated network for each job. Caps each
  job container at 1GB of memory.
- Adds a 2GB swap file, because Forgejo already uses about half of this
  machine's 2GB of RAM.
- Prunes unused Docker data weekly, since this disk has filled up before.

Also sets an explicit [actions] section in app.ini, with shorter log and
artifact retention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ
- Pass --keep-labels when registering. Without it, re-running the
  playbook wiped the runner's labels in Forgejo, and since the daemon
  only declares its labels at startup, jobs would wait forever until the
  runner next restarted.
- Read the UUID from the last line of the CLI's output, in case it logs
  anything first, and let registration run in --check mode.
- Decide whether to create the swap file by whether it's active, so a
  half-finished earlier run doesn't block it forever.
- Move the runner secret to files/runner-secret, since setup-forgejo.yml
  copies all of files/secrets to the server.
- Fix a comment: the memory cap applies to service containers too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014PWWczf6WkuBDdUASWtRcZ
matchu merged commit 6db62894c6 into main 2026-11-08 19:32:14 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
OpenNeo/openneo-code!1
No description provided.