ci: split production build Jenkins nodes
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-06 14:04:12 +08:00
parent 0fae3319a9
commit 96e1d7c4fb
4 changed files with 32 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
pipeline {
agent {
label 'linux && genarrative-build'
label 'linux && genarrative-rust-api'
}
options {
@@ -10,12 +10,12 @@ pipeline {
}
environment {
GIT_REMOTE_URL = 'http://127.0.0.1:3000/GenarrativeAI/Genarrative.git'
CARGO_HOME = '/var/cache/genarrative-build/api-server/cargo-home'
CARGO_TARGET_DIR = '/var/cache/genarrative-build/api-server/cargo-target/prod-release'
GIT_REMOTE_URL = 'http://82.157.175.59:3000/GenarrativeAI/Genarrative.git'
CARGO_HOME = '/home/dsk/.cache/genarrative-jenkins/api-server/cargo-home'
CARGO_TARGET_DIR = '/home/dsk/.cache/genarrative-jenkins/api-server/cargo-target/prod-release'
CARGO_INCREMENTAL = '0'
RUSTC_WRAPPER = 'sccache'
SCCACHE_DIR = '/var/cache/genarrative-build/api-server/sccache'
SCCACHE_DIR = '/home/dsk/.cache/genarrative-jenkins/api-server/sccache'
SCCACHE_CACHE_SIZE = '30G'
}

View File

@@ -12,7 +12,7 @@ pipeline {
}
environment {
GIT_REMOTE_URL = 'http://127.0.0.1:3000/GenarrativeAI/Genarrative.git'
GIT_REMOTE_URL = 'http://82.157.175.59:3000/GenarrativeAI/Genarrative.git'
}
parameters {

View File

@@ -1,6 +1,6 @@
pipeline {
agent {
label 'linux && genarrative-build'
label 'built-in && windows'
}
options {
@@ -10,12 +10,12 @@ pipeline {
}
environment {
GIT_REMOTE_URL = 'http://127.0.0.1:3000/GenarrativeAI/Genarrative.git'
CARGO_HOME = '/var/cache/genarrative-build/stdb-module/cargo-home'
CARGO_TARGET_DIR = '/var/cache/genarrative-build/stdb-module/cargo-target/prod-release'
GIT_REMOTE_URL = 'http://82.157.175.59:3000/GenarrativeAI/Genarrative.git'
CARGO_HOME = '${env.WORKSPACE_TMP}/cargo-home'
CARGO_TARGET_DIR = '${env.WORKSPACE_TMP}/cargo-target/prod-release'
CARGO_INCREMENTAL = '0'
RUSTC_WRAPPER = 'sccache'
SCCACHE_DIR = '/var/cache/genarrative-build/stdb-module/sccache'
SCCACHE_DIR = '${env.USERPROFILE}\\.cache\\sccache-stdb-module'
SCCACHE_CACHE_SIZE = '30G'
}
@@ -41,16 +41,19 @@ pipeline {
extensions: [[$class: 'CleanBeforeCheckout']],
userRemoteConfigs: [[url: "${GIT_REMOTE_URL}"]],
])
sh '''
bash -lc '
set -euo pipefail
chmod +x scripts/jenkins-checkout-source.sh
SOURCE_BRANCH="${SOURCE_BRANCH:-master}" \
COMMIT_HASH="${COMMIT_HASH:-}" \
GIT_REMOTE_URL="${GIT_REMOTE_URL}" \
SOURCE_COMMIT_FILE=".jenkins-source-commit" \
scripts/jenkins-checkout-source.sh
'
powershell '''
$ErrorActionPreference = 'Stop'
$sourceBranch = if ($env:SOURCE_BRANCH) { $env:SOURCE_BRANCH } else { 'master' }
$commitHash = if ($env:COMMIT_HASH) { $env:COMMIT_HASH } else { '' }
$gitRemoteUrl = if ($env:GIT_REMOTE_URL) { $env:GIT_REMOTE_URL } else { 'http://82.157.175.59:3000/GenarrativeAI/Genarrative.git' }
git fetch --no-tags --prune $gitRemoteUrl "+refs/heads/$sourceBranch:refs/remotes/origin/$sourceBranch"
if ($commitHash) {
git checkout --force $commitHash
} else {
git checkout --force "origin/$sourceBranch"
}
git clean -ffdx
git rev-parse HEAD | Set-Content -Encoding UTF8 .jenkins-source-commit
'''
script {
env.SOURCE_COMMIT = readFile('.jenkins-source-commit').trim()
@@ -61,13 +64,17 @@ pipeline {
stage('Build Stdb Module') {
steps {
sh '''
powershell '''
$ErrorActionPreference = 'Stop'
if (-not (Get-Command bash -ErrorAction SilentlyContinue)) {
throw '[stdb-build] Windows 构建节点缺少 bash无法执行仓库现有生产构建脚本。请先安装 Git Bash 或 WSL bash并确保 bash 在 PATH 中。'
}
bash -lc '
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
if ! command -v cargo >/dev/null 2>&1; then
echo "[stdb-build] 缺少 cargo。请先在 Windows 构建节点安装 Rust 工具链。" >&2
exit 1
fi
if ! command -v sccache >/dev/null 2>&1; then

View File

@@ -10,7 +10,7 @@ pipeline {
}
environment {
GIT_REMOTE_URL = 'http://127.0.0.1:3000/GenarrativeAI/Genarrative.git'
GIT_REMOTE_URL = 'http://82.157.175.59:3000/GenarrativeAI/Genarrative.git'
WEB_ARTIFACT_ROOT = '/var/cache/genarrative-build/web-artifacts'
}