--- # Disk hygiene for the Pi's build host. # # Every push builds images on the Pi's own docker daemon (deploy-site's arm64 # image, onionwire's ci build containers) and nothing ever removed them: the # single / volume sat at 76% (666G/917G) with weeks of exited job containers # and superseded image layers. On one volume that is a slow-motion outage. # # Prune keeps a week of images (a rollback window), 48h of exited containers, # and 72h of builder cache. It runs against the host socket, so it sees exactly # the containers the runners created. apiVersion: batch/v1 kind: CronJob metadata: name: forgejo-runner-prune namespace: forgejo labels: app: forgejo-runner role: prune spec: schedule: "17 4 * * *" timeZone: "Etc/UTC" concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 jobTemplate: spec: backoffLimit: 1 # Container/image removal on the Pi runs at minutes-per-dozen under load # (measured: 48 containers in ~10 min with a ci job live). One hour keeps # the nightly run from being killed half-way through the image prune. activeDeadlineSeconds: 3600 template: spec: restartPolicy: Never nodeSelector: kubernetes.io/hostname: rpi tolerations: - key: dedicated operator: Equal value: network effect: PreferNoSchedule containers: - name: prune image: docker:27-cli imagePullPolicy: IfNotPresent command: - sh - -c - | set -e echo "== before"; docker system df docker container prune -f --filter until=48h || true docker image prune -af --filter until=168h || true # --filter until=72h reclaimed 0 B on a 74 GB cache (proven # 2026-10-23): the filter is a no-op here, --keep-storage is # deterministic and reclaimed 53 GB keeping a 20 GB warm cache. # Never prune volumes: onionwire-target-ci and the mobile # SDK/Gradle caches are "unused" between runs but essential. docker builder prune -af --keep-storage 20GB || true echo "== after"; docker system df volumeMounts: - name: docker-sock mountPath: /var/run/docker.sock resources: requests: cpu: 10m memory: 32Mi limits: memory: 128Mi volumes: - name: docker-sock hostPath: path: /var/run/docker.sock type: Socket