sccache forces CARGO_INCREMENTAL=0, causing all 37 workspace crates to recompile from scratch every CI run (~20 min). Only upstream deps were cached (635 hits); 109 workspace rlib crates were non-cacheable. Changes: - Add cargo-target-cpu and cargo-target-cuda PVCs (30Gi each) - Mount persistent target dir at /cargo-target via CARGO_TARGET_DIR - Drop RUSTC_WRAPPER=sccache and SCCACHE_DIR from both compile steps - Drop hardcoded CARGO_BUILD_JOBS=14 (let cargo auto-detect from nproc) - Add 25GB cleanup guard to prevent unbounded PVC growth - Update binary copy paths to use $CARGO_TARGET_DIR/release/ First build (cold PVC) is same speed. Subsequent builds with typical 3-5 file changes should drop from ~20 min to ~2-3 min via incremental. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
# Persistent cargo target directories for incremental compilation.
|
|
#
|
|
# Why: sccache can't cache workspace rlib crates (109 non-cacheable per build).
|
|
# Persisting target/ lets cargo's incremental compilation skip unchanged crates,
|
|
# reducing typical CI builds from ~20 min (full rebuild) to ~2-3 min.
|
|
#
|
|
# Two separate PVCs because compile-services (no cuda feature) and
|
|
# compile-training (cuda feature) produce incompatible artifacts.
|
|
#
|
|
# NOTE: Only one workflow should use each PVC at a time. ci-pipeline and
|
|
# compile-and-train must not run their compile steps concurrently.
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: cargo-target-cpu
|
|
namespace: foxhunt
|
|
labels:
|
|
app.kubernetes.io/name: cargo-target
|
|
app.kubernetes.io/component: ci-cache
|
|
app.kubernetes.io/part-of: foxhunt
|
|
spec:
|
|
accessModes: [ReadWriteOnce]
|
|
storageClassName: scw-bssd-retain
|
|
resources:
|
|
requests:
|
|
storage: 30Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: cargo-target-cuda
|
|
namespace: foxhunt
|
|
labels:
|
|
app.kubernetes.io/name: cargo-target
|
|
app.kubernetes.io/component: ci-cache
|
|
app.kubernetes.io/part-of: foxhunt
|
|
spec:
|
|
accessModes: [ReadWriteOnce]
|
|
storageClassName: scw-bssd-retain
|
|
resources:
|
|
requests:
|
|
storage: 30Gi
|