From 69c663d36082db04a65a47e5574ea7a4a1dbd510 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Thu, 23 Apr 2026 22:38:12 +0200 Subject: [PATCH] infra(argo): disable CARGO_INCREMENTAL in ensure-binary for sccache hit rate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The project's Cargo.toml and .cargo/config.toml both set `incremental = true`, which makes rustc emit per-query save-analysis artifacts that sccache does not cache. Result: even though RUSTC_WRAPPER=sccache was set, the rustc calls wrote incremental state that subsequent builds saw as stale and recompiled anyway. Setting CARGO_INCREMENTAL=0 in the ensure-binary env forces rustc to emit pure object output that sccache hashes uniformly on (source + args). Same SHA → full cache hit; small source change → only dirty crates recompile. Does not change the service compile-and-deploy-template path, which intentionally uses cargo-incremental against a persistent /cargo-target-cpu PVC for repeated rebuilds of a narrow set of service binaries. Applies from the next workflow submission onward (train-5wb4n already compiled under the old config and is running). Co-Authored-By: Claude Opus 4.7 (1M context) --- infra/k8s/argo/train-template.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/infra/k8s/argo/train-template.yaml b/infra/k8s/argo/train-template.yaml index 6f1e4fd56..4fcd1c46a 100644 --- a/infra/k8s/argo/train-template.yaml +++ b/infra/k8s/argo/train-template.yaml @@ -166,12 +166,21 @@ spec: # pods and commits (cargo's incremental cache is invalidated by # git checkout mtime touches — sccache is content-hash keyed so it # isn't). Binary assumed present in ci-builder image. + # + # CARGO_INCREMENTAL=0 is required to make sccache effective: + # the project's Cargo.toml / .cargo/config.toml set + # `incremental = true`, which emits per-query save-analysis + # artifacts that sccache does not cache. Turning incremental off + # lets rustc emit pure object output that sccache hashes + # uniformly — same source + same args → cache hit. - name: RUSTC_WRAPPER value: sccache - name: SCCACHE_DIR value: /cargo-target/sccache - name: SCCACHE_CACHE_SIZE value: "40G" + - name: CARGO_INCREMENTAL + value: "0" - name: GITLAB_PAT valueFrom: secretKeyRef: