ci(argo): wire sccache into compile-and-deploy-template
Mount the existing sccache-cpu PVC and set RUSTC_WRAPPER=sccache for the regular service-build pipeline. Previously only train-template and train-multi-seed-template used sccache; the production CI build had zero rustc-level caching, so every CI run rebuilt every dep from scratch. Also set CARGO_INCREMENTAL=0 to override the workspace-wide [build] incremental = true in .cargo/config.toml. sccache documented limitation: cannot cache incremental rustc output. Local dev keeps incremental via config.toml unchanged. Print sccache --show-stats at end of build for visibility into cache hit rates. Mirror of train-template.yaml's sccache pattern; uses the sccache-cpu PVC (20Gi, scw-bssd-retain) which was already provisioned but unmounted. Expected impact: rustc cache hit rate jumps from 0% → 50-90% on subsequent CI runs.
This commit is contained in:
@@ -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 ──
|
||||
|
||||
Reference in New Issue
Block a user