Install production build toolchain in provision

This commit is contained in:
2026-05-02 22:10:01 +08:00
parent 73d5ef40ed
commit ace13c7047
5 changed files with 38 additions and 3 deletions

View File

@@ -64,6 +64,10 @@ pipeline {
set -euo pipefail
chmod +x scripts/jenkins-prepare-cargo-env.sh
source scripts/jenkins-prepare-cargo-env.sh
if ! command -v clang >/dev/null 2>&1 || ! command -v lld >/dev/null 2>&1; then
echo "[api-build] 缺少 clang/lld。请先运行 Genarrative-Server-Provision 安装 Linux 构建依赖。" >&2
exit 1
fi
if ! command -v sccache >/dev/null 2>&1; then
echo "[api-build] 未找到 sccache改用 rustc 直接构建。"
unset RUSTC_WRAPPER

View File

@@ -66,6 +66,8 @@ pipeline {
}
stage('Build Components') {
// 任一构建分支失败时立即中断其他并行分支,避免失败后继续消耗构建资源。
failFast true
parallel {
stage('Web') {
steps {

View File

@@ -123,6 +123,21 @@ pipeline {
fi
}
install_build_dependencies() {
echo "[server-provision] 安装 Linux 构建依赖: clang, lld, pkg-config, OpenSSL headers"
if command -v apt-get >/dev/null 2>&1; then
run_cmd apt-get update
run_cmd apt-get install -y clang lld pkg-config libssl-dev ca-certificates
elif command -v dnf >/dev/null 2>&1; then
run_cmd dnf install -y clang lld pkgconf-pkg-config openssl-devel ca-certificates
elif command -v yum >/dev/null 2>&1; then
run_cmd yum install -y clang lld pkgconf-pkg-config openssl-devel ca-certificates
else
echo "[server-provision] 未找到 apt-get/dnf/yum无法自动安装 clang/lld。请手动安装后重跑构建。" >&2
exit 1
fi
}
render_nginx_https_config() {
sed "s/genarrative.example.com/${SERVER_NAME}/g" deploy/nginx/genarrative.conf
}
@@ -174,6 +189,7 @@ pipeline {
if [[ "${DRY_RUN}" == "true" ]]; then
echo "+ nginx -t"
echo "+ nginx -s reload"
return
fi
@@ -216,6 +232,8 @@ pipeline {
rm -f "${rendered_config}" "${rendered_snippet}" "${config_backup}" "${snippet_backup}"
exit 1
fi
echo "+ nginx -s reload"
nginx -s reload
rm -f "${rendered_config}" "${rendered_snippet}" "${config_backup}" "${snippet_backup}"
}
@@ -239,6 +257,9 @@ pipeline {
if command -v nginx >/dev/null 2>&1; then
if ! nginx -t; then
echo "[server-provision] 占位配置已禁用,但 nginx -t 仍失败;请检查其他 Nginx 配置。" >&2
else
echo "+ nginx -s reload"
nginx -s reload
fi
fi
fi
@@ -279,6 +300,7 @@ pipeline {
echo "[server-provision] target=${DEPLOY_TARGET}, dry_run=${DRY_RUN}, nginx_config_mode=${NGINX_CONFIG_MODE}, source_commit=$(cat .jenkins-source-commit)"
run_cmd id
install_build_dependencies
run_cmd mkdir -p "${SPACETIME_ROOT}" "${RELEASE_ROOT}" "$(dirname "${CURRENT_LINK}")" "$(dirname "${WEB_LINK}")" /etc/genarrative /var/lib/genarrative/maintenance /var/lib/genarrative/auth
if ! id spacetimedb >/dev/null 2>&1; then

View File

@@ -65,6 +65,10 @@ pipeline {
set -euo pipefail
chmod +x scripts/jenkins-prepare-cargo-env.sh
source scripts/jenkins-prepare-cargo-env.sh
if ! command -v clang >/dev/null 2>&1 || ! command -v lld >/dev/null 2>&1; then
echo "[stdb-build] 缺少 clang/lld。请先运行 Genarrative-Server-Provision 安装 Linux 构建依赖。" >&2
exit 1
fi
if ! command -v sccache >/dev/null 2>&1; then
echo "[stdb-build] 未找到 sccache改用 rustc 直接构建。"
unset RUSTC_WRAPPER