infra(argo): disable CARGO_INCREMENTAL in ensure-binary for sccache hit rate

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) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-23 22:38:12 +02:00
parent 15818dce01
commit 69c663d360

View File

@@ -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: