chore: move jenkins caches under home

This commit is contained in:
2026-06-01 06:30:49 +00:00
parent 6cd554473b
commit 751c742b0f
4 changed files with 23 additions and 10 deletions

View File

@@ -12,7 +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'
WEB_ARTIFACT_ROOT = '/var/cache/genarrative-build/web-artifacts'
WEB_ARTIFACT_ROOT = 'caches/genarrative-build/web-artifacts'
}
parameters {
@@ -94,7 +94,11 @@ pipeline {
bash -lc '
set -euo pipefail
artifact_dir="${WEB_ARTIFACT_ROOT}/${JOB_NAME}/${BUILD_NUMBER}/${EFFECTIVE_BUILD_VERSION}"
web_artifact_root="${WEB_ARTIFACT_ROOT:-caches/genarrative-build/web-artifacts}"
if [[ "${web_artifact_root}" != /* ]]; then
web_artifact_root="${HOME:?HOME 不能为空}/${web_artifact_root}"
fi
artifact_dir="${web_artifact_root}/${JOB_NAME}/${BUILD_NUMBER}/${EFFECTIVE_BUILD_VERSION}"
mkdir -p "${artifact_dir}"
rm -f "${artifact_dir}/web.tar.gz" "${artifact_dir}/web.tar.gz.sha256" "${artifact_dir}/release-manifest.json"
install -m 0644 "build/${EFFECTIVE_BUILD_VERSION}/web.tar.gz" "${artifact_dir}/web.tar.gz"
@@ -109,7 +113,7 @@ WEB_ARTIFACT_VERSION=${EFFECTIVE_BUILD_VERSION}
EOF
echo "[web-build] Web 大包已保存在构建机本地目录: ${artifact_dir}"
find "${WEB_ARTIFACT_ROOT}/${JOB_NAME}" -mindepth 1 -maxdepth 1 -type d -mtime +14 -print -exec rm -rf {} +
find "${web_artifact_root}/${JOB_NAME}" -mindepth 1 -maxdepth 1 -type d -mtime +14 -print -exec rm -rf {} +
'
'''
archiveArtifacts artifacts: "build/${env.EFFECTIVE_BUILD_VERSION}/web.tar.gz.sha256,build/${env.EFFECTIVE_BUILD_VERSION}/release-manifest.json,build/${env.EFFECTIVE_BUILD_VERSION}/web-artifact-pointer.txt", fingerprint: false