Migrate Forgejo runner to Kubernetes with DinD #60

Merged
eblume merged 15 commits from feature/containerized-runner into main 2026-01-25 19:56:17 -08:00
7 changed files with 0 additions and 161 deletions
Showing only changes of commit 4927c79f5b - Show all commits

Retire host-mode forgejo runner (Phase 3 complete)

- Remove forgejo_runner ansible role (no longer needed)
- Remove runner pre_tasks from indri.yml playbook
- Clean up actionlint.yaml to only allow k8s label
- Host runner was stopped and cleaned up on indri

All CI jobs now run on the k8s runner with DinD sidecar.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Erich Blume 2026-01-25 19:31:00 -08:00

View file

@ -1,5 +1,3 @@
self-hosted-runner:
labels:
- ubuntu-latest
- docker
- k8s

View file

@ -61,23 +61,6 @@
no_log: true
tags: [forgejo]
# Forgejo runner token (for indri-based runner)
- name: Fetch forgejo runner token
ansible.builtin.command:
cmd: op --vault vg6xf6vvfmoh5hqjjhlhbeoaie item get w3663ffnvkewbftncqxtcpeavy --fields runner_reg --reveal
delegate_to: localhost
register: _forgejo_runner_token
changed_when: false
no_log: true
check_mode: false
tags: [forgejo_runner]
- name: Set forgejo runner token fact
ansible.builtin.set_fact:
forgejo_runner_token: "{{ _forgejo_runner_token.stdout }}"
no_log: true
tags: [forgejo_runner]
# Caddy Gandi token for ACME DNS-01 challenges
- name: Fetch Gandi PAT for Caddy
ansible.builtin.command:
@ -114,7 +97,5 @@
tags: minikube_metrics
- role: plex_metrics
tags: plex_metrics
- role: forgejo_runner
tags: forgejo_runner
- role: caddy
tags: caddy

View file

@ -1,26 +0,0 @@
---
# Forgejo Runner - hybrid host/docker execution
#
# The runner daemon runs directly on indri. Jobs can run either:
# - On host (ubuntu-latest:host) - for builds needing host tools
# - In Docker (docker:docker://...) - for containerized builds
#
# The docker mode uses our custom job execution image with Node.js and Docker CLI.
forgejo_runner_binary: /Users/erichblume/code/3rd/forgejo-runner/forgejo-runner
forgejo_runner_data_dir: /Users/erichblume/.forgejo-runner
forgejo_runner_config_dir: /Users/erichblume/.config/forgejo-runner
forgejo_runner_log_dir: /Users/erichblume/Library/Logs
# Runner registration - use public URL so it works from both host and containers
forgejo_runner_instance_url: "https://forge.ops.eblu.me"
forgejo_runner_name: "indri-host-runner"
# Labels: both host and docker modes
# - ubuntu-latest:host - jobs run directly on host
# - docker:docker://... - jobs run in container with Node.js + Docker CLI
forgejo_runner_labels: "ubuntu-latest:host,docker:docker://registry.ops.eblu.me/blumeops/forgejo-runner:v2.1.0"
# Runner config
forgejo_runner_capacity: 2
forgejo_runner_timeout: 3h

View file

@ -1,7 +0,0 @@
---
- name: Restart forgejo-runner
listen: Restart forgejo-runner
ansible.builtin.shell: |
launchctl unload ~/Library/LaunchAgents/mcquack.forgejo-runner.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/mcquack.forgejo-runner.plist
changed_when: true

View file

@ -1,57 +0,0 @@
---
# Forgejo Runner - host execution mode
#
# The runner daemon runs directly on indri using a locally compiled binary.
# Jobs execute on the host, reaching Forgejo at localhost:3001.
- name: Ensure forgejo-runner directories exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ forgejo_runner_data_dir }}"
- "{{ forgejo_runner_config_dir }}"
- name: Deploy forgejo-runner config
ansible.builtin.template:
src: config.yaml.j2
dest: "{{ forgejo_runner_config_dir }}/config.yaml"
mode: '0644'
notify: Restart forgejo-runner
- name: Check if runner is registered
ansible.builtin.stat:
path: "{{ forgejo_runner_data_dir }}/.runner"
register: forgejo_runner_registered
- name: Register runner with Forgejo
ansible.builtin.command:
cmd: >
{{ forgejo_runner_binary }} register
--instance "{{ forgejo_runner_instance_url }}"
--token "{{ forgejo_runner_token }}"
--name "{{ forgejo_runner_name }}"
--labels "{{ forgejo_runner_labels }}"
--no-interactive
chdir: "{{ forgejo_runner_data_dir }}"
when: not forgejo_runner_registered.stat.exists
changed_when: true
- name: Deploy forgejo-runner launchd plist
ansible.builtin.template:
src: forgejo-runner.plist.j2
dest: ~/Library/LaunchAgents/mcquack.forgejo-runner.plist
mode: '0644'
notify: Restart forgejo-runner
- name: Check if forgejo-runner is loaded
ansible.builtin.command: launchctl list mcquack.forgejo-runner
register: forgejo_runner_launchctl_check
changed_when: false
failed_when: false
- name: Load forgejo-runner if not loaded
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.forgejo-runner.plist
when: forgejo_runner_launchctl_check.rc != 0
changed_when: true

View file

@ -1,17 +0,0 @@
# {{ ansible_managed }}
log:
level: info
runner:
file: {{ forgejo_runner_data_dir }}/.runner
capacity: {{ forgejo_runner_capacity }}
timeout: {{ forgejo_runner_timeout }}
# Container settings for docker execution mode
container:
# Host networking so containers can reach services (forge.ops.eblu.me, etc.)
network: "host"
# Mount Docker socket for container builds (DinD)
options: "-v /var/run/docker.sock:/var/run/docker.sock"
valid_volumes:
- /var/run/docker.sock

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- {{ ansible_managed }} -->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mcquack.forgejo-runner</string>
<key>ProgramArguments</key>
<array>
<string>{{ forgejo_runner_binary }}</string>
<string>daemon</string>
<string>--config</string>
<string>{{ forgejo_runner_config_dir }}/config.yaml</string>
</array>
<key>WorkingDirectory</key>
<string>{{ forgejo_runner_data_dir }}</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/Users/erichblume/.local/share/mise/shims:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>HOME</key>
<string>/Users/erichblume</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>{{ forgejo_runner_log_dir }}/mcquack.forgejo-runner.out.log</string>
<key>StandardErrorPath</key>
<string>{{ forgejo_runner_log_dir }}/mcquack.forgejo-runner.err.log</string>
</dict>
</plist>