优化 Stdb 模块构建缓存

将 production-stdb-module-build 的 Cargo 与 sccache 目录迁移到稳定缓存根。

补充生产运维文档,说明 GENARRATIVE_STDB_CACHE_ROOT 覆盖口径。
This commit is contained in:
kdletters
2026-06-09 17:40:11 +08:00
parent 7eae91d7d3
commit 4ed9711b76
2 changed files with 9 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ pipeline {
environment {
GIT_REMOTE_URL = 'http://127.0.0.1:3000/GenarrativeAI/Genarrative.git'
GIT_REMOTE_FALLBACK_URL = 'https://git.genarrative.world/GenarrativeAI/Genarrative.git'
GENARRATIVE_STDB_CACHE_ROOT = 'caches/genarrative-jenkins/stdb-module'
CARGO_INCREMENTAL = '0'
RUSTC_WRAPPER = 'sccache'
SCCACHE_CACHE_SIZE = '30G'
@@ -81,12 +82,15 @@ pipeline {
sh '''
bash -lc '
set -euo pipefail
workspace_tmp="${WORKSPACE_TMP:-${WORKSPACE}@tmp}"
export CARGO_HOME="${workspace_tmp}/cargo-home"
export CARGO_TARGET_DIR="${workspace_tmp}/cargo-target/prod-release"
stdb_cache_root="${GENARRATIVE_STDB_CACHE_ROOT:-caches/genarrative-jenkins/stdb-module}"
if [[ "${stdb_cache_root}" != /* ]]; then
stdb_cache_root="${HOME:?HOME 不能为空}/${stdb_cache_root}"
fi
export CARGO_HOME="${stdb_cache_root}/cargo-home"
export CARGO_TARGET_DIR="${stdb_cache_root}/cargo-target/prod-release"
export CARGO_INCREMENTAL=0
export RUSTC_WRAPPER=sccache
export SCCACHE_DIR="${workspace_tmp}/sccache-stdb-module"
export SCCACHE_DIR="${stdb_cache_root}/sccache"
export SCCACHE_CACHE_SIZE=30G
mkdir -p "${CARGO_HOME}" "${CARGO_TARGET_DIR}" "${SCCACHE_DIR}"
chmod +x scripts/jenkins-prepare-cargo-env.sh