chore: update Jenkins deploy pipeline controls

This commit is contained in:
2026-04-24 11:59:42 +08:00
parent 2680662003
commit f63331a1b9
4 changed files with 46 additions and 26 deletions

View File

@@ -30,6 +30,16 @@ pipeline {
dir("${env.WORKSPACE_ROOT}") {
checkout scm
sh '''
bash -lc '
set -euo pipefail
# 构建前清理工作区内的 Git 变更和未跟踪文件,避免复用固定源码目录时受到上次构建残留影响。
# 这里不使用 -x避免删除 node_modules 等忽略目录后与 RUN_NPM_CI=false 的配置冲突。
git reset --hard HEAD
git clean -fd
'
'''
script {
// 是否重装依赖交给流水线参数决定,避免每次构建都重复执行 npm ci。
if (params.RUN_NPM_CI) {