diff --git a/infra/k8s/argo/compile-and-deploy-template.yaml b/infra/k8s/argo/compile-and-deploy-template.yaml index 4759b0d98..f49526dc6 100644 --- a/infra/k8s/argo/compile-and-deploy-template.yaml +++ b/infra/k8s/argo/compile-and-deploy-template.yaml @@ -44,6 +44,9 @@ spec: - name: cargo-target-cpu persistentVolumeClaim: claimName: cargo-target-cpu + - name: sccache + persistentVolumeClaim: + claimName: sccache-cpu templates: - name: pipeline @@ -179,6 +182,21 @@ spec: value: /cargo-target - name: CARGO_HOME value: /cargo-target/cargo-home + # sccache: rustc wrapper that content-hashes compile inputs and reuses + # object output across pods/commits via the sccache-cpu PVC. Survives + # cargo's incremental-cache invalidation from git checkout mtime touches. + - name: RUSTC_WRAPPER + value: sccache + - name: SCCACHE_DIR + value: /sccache-cache + - name: SCCACHE_CACHE_SIZE + value: 20G + # Required: workspace `.cargo/config.toml` sets [build] incremental = true, + # which forces incremental compilation even on --release. sccache cannot + # cache incremental rustc output (documented limitation). Override here + # so sccache actually catches. Local dev keeps incremental via config.toml. + - name: CARGO_INCREMENTAL + value: "0" - name: GITLAB_PAT valueFrom: secretKeyRef: @@ -197,6 +215,8 @@ spec: readOnly: true - name: cargo-target-cpu mountPath: /cargo-target + - name: sccache + mountPath: /sccache-cache args: - | set -e @@ -312,6 +332,9 @@ spec: "${GITLAB}/api/v4/projects/1/packages/generic/foxhunt-services/latest/${BIN_NAME}" || true done + echo "=== sccache stats ===" + sccache --show-stats || true + echo "=== Service compile + upload done ($SERVICE_PKGS) ===" # ── upload-release: create GitLab Release with package links ──