From c3e9f1609b1e62ce3bde17901dd4bb2ec00ec3bf Mon Sep 17 00:00:00 2001
From: SeanOMik <seanomik@gmail.com>
Date: Thu, 2 Jan 2025 13:48:13 -0500
Subject: [PATCH] fix(forgejo-runner): change cache mount path

---
 .../main/apps/dev/forgejo-runner/app/config.yaml     |  2 +-
 .../main/apps/dev/forgejo-runner/app/runner-dep.yaml | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/kubernetes/main/apps/dev/forgejo-runner/app/config.yaml b/kubernetes/main/apps/dev/forgejo-runner/app/config.yaml
index 9128046a..e5fdc202 100644
--- a/kubernetes/main/apps/dev/forgejo-runner/app/config.yaml
+++ b/kubernetes/main/apps/dev/forgejo-runner/app/config.yaml
@@ -59,7 +59,7 @@ data:
       enabled: true
       # The directory to store the cache data.
       # If it's empty, the cache data will be stored in $HOME/.cache/actcache.
-      dir: ""
+      dir: "/cache"
       # The host of the cache server.
       # It's not for the address to listen, but the address to connect from job containers.
       # So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
diff --git a/kubernetes/main/apps/dev/forgejo-runner/app/runner-dep.yaml b/kubernetes/main/apps/dev/forgejo-runner/app/runner-dep.yaml
index 49c9dce2..f87bd868 100644
--- a/kubernetes/main/apps/dev/forgejo-runner/app/runner-dep.yaml
+++ b/kubernetes/main/apps/dev/forgejo-runner/app/runner-dep.yaml
@@ -51,10 +51,16 @@ spec:
             - name: runner-data
               mountPath: /data
         # fix permissions of cache pvc
-        - command: ["sh", "-c", "chown -R 1000:1000 /data/.cache"]
+        - command:
+          - "sh"
+          - "-c"
+          - |
+            find /cache -type d -exec chmod 775 {} +
+            find /cache -type f -exec chmod 664 {} +
+            chown -R 1000:1000 /cache
           image: busybox
           volumeMounts:
-          - mountPath: /data/.cache/actcache
+          - mountPath: /cache
             name: forgejo-runner-cache
           name: fix-permissions
       containers:
@@ -80,7 +86,7 @@ spec:
           mountPath: /data/config.yml
           subPath: config.yml
         - name: forgejo-runner-cache
-          mountPath: /data/.cache/actcache
+          mountPath: /cache
       - name: daemon
         image: docker:27.4.1-dind
         env: