Runner: turn on the Actions dependency cache (G8)
Demo / hello (push) Successful in 16s

The runner's built-in cache server now backs actions/cache.

- In the cluster, cache blobs go on a new PVC (gitea-actions-cache, 20Gi,
  default storage class) mounted at /cache in the runner container, so the
  cache survives runner restarts. The role creates the PVC before the
  Helm release. NFS doesn't enforce the size; the runner's own expiry
  (unused 7 days, or older than 30 days) keeps it bounded.
- Fixed port 8088. Job containers reach it at the pod IP, which DinD's
  per-job networks route to because DinD shares the pod's network.
- The dedicated-host runner gets the same config, with the cache on a
  bind mount under gitea_actions_host_dir.
- gitea_actions_cache_enabled: false turns it all off again.

Refs DevOps/software-infrastructure#56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 09:22:21 -05:00
co-authored by Claude Opus 5.5
parent 3974f603fc
commit 96e5b92bec
5 changed files with 53 additions and 6 deletions
+20
View File
@@ -134,6 +134,24 @@ gitea_actions_runner_labels:
- "ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04-v26.11.03"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04-v26.11.03"
# Actions dependency cache (G8). The runner's built-in cache server backs
# actions/cache (v4 and v5 both work; they use its v1 API). Job containers
# reach it at the pod's own IP, which DinD's job networks route to because
# DinD shares the pod's network. Requests are authenticated per job and
# scoped per repository by the runner.
gitea_actions_cache_enabled: true
# Fixed port, so the address is predictable when reading logs or writing
# network rules. Nothing outside the pod needs it.
gitea_actions_cache_port: 8088
# Where cache blobs live inside the runner container.
gitea_actions_cache_dir: /cache
# In the cluster: a PVC on the default storage class (NFS), so the cache
# survives runner restarts. NFS doesn't enforce the size; the runner's own
# expiry keeps it bounded (entries unused for 7 days, and any entry older
# than 30 days, are removed).
gitea_actions_cache_pvc: gitea-actions-cache
gitea_actions_cache_size: 20Gi
# Gitea's [actions] settings (option names checked against Gitea 1.27.0's
# modules/setting/actions.go; defaults in brackets).
# A running task whose runner stops reporting for this long is failed. [10m]
@@ -174,3 +192,5 @@ gitea_actions_host_dind_cpu_shares: 512
gitea_actions_host_dind_memory: 16g
# shutdown_timeout + report_close_timeout plus a margin.
gitea_actions_host_stop_grace_period: 40s
# Actions cache directory on the host, mounted at gitea_actions_cache_dir.
gitea_actions_host_cache_dir: "{{ gitea_actions_host_dir }}/cache"
+28 -5
View File
@@ -61,6 +61,22 @@
--tags actions.
quiet: true
- name: create the actions cache volume
when: gitea_actions_cache_enabled | bool
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "{{ gitea_actions_cache_pvc }}"
namespace: gitea
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "{{ gitea_actions_cache_size }}"
- name: deploy gitea actions runner
kubernetes.core.helm:
name: gitea-actions
@@ -107,10 +123,12 @@
size: 1Gi
# Chart 0.1.2 renders nodeSelector correctly for one key only.
nodeSelector: "{{ gitea_actions_runner_node_selector }}"
extraVolumes:
- name: docker-data
emptyDir:
sizeLimit: "{{ gitea_actions_docker_data_size }}"
extraVolumes: >-
{{ [{'name': 'docker-data',
'emptyDir': {'sizeLimit': gitea_actions_docker_data_size}}]
+ ([{'name': 'actions-cache',
'persistentVolumeClaim': {'claimName': gitea_actions_cache_pvc}}]
if gitea_actions_cache_enabled | bool else []) }}
dind:
extraVolumeMounts:
- name: docker-data
@@ -126,11 +144,16 @@
ephemeral-storage: "{{ gitea_actions_dind_ephemeral_limit }}"
runner:
resources: "{{ gitea_actions_runner_resources }}"
extraVolumeMounts: >-
{{ [{'name': 'actions-cache', 'mountPath': gitea_actions_cache_dir}]
if gitea_actions_cache_enabled | bool else [] }}
config: |
log:
level: info
cache:
enabled: false
enabled: {{ gitea_actions_cache_enabled | bool | lower }}
dir: {{ gitea_actions_cache_dir }}
port: {{ gitea_actions_cache_port }}
container:
require_docker: true
docker_timeout: 300s
+1
View File
@@ -29,6 +29,7 @@
- "{{ gitea_actions_host_dir }}"
- "{{ gitea_actions_host_dir }}/data"
- "{{ gitea_actions_host_dir }}/token"
- "{{ gitea_actions_host_cache_dir }}"
- "{{ gitea_actions_host_docker_data }}"
- name: check whether the runner is already registered
+1
View File
@@ -56,6 +56,7 @@ services:
- ./config.yaml:/runner/config.yaml:ro
- ./data:/data
- ./token:/token:ro
- {{ gitea_actions_host_cache_dir }}:{{ gitea_actions_cache_dir }}
- docker-socket:/run/dind
mem_limit: 512m
logging: *logging
+3 -1
View File
@@ -4,7 +4,9 @@
log:
level: info
cache:
enabled: false
enabled: {{ gitea_actions_cache_enabled | bool | lower }}
dir: {{ gitea_actions_cache_dir }}
port: {{ gitea_actions_cache_port }}
container:
require_docker: true
docker_timeout: 300s