Reset Jenkins workspaces before build deploy and migration

This commit is contained in:
kdletters
2026-05-01 22:57:00 +08:00
parent 1abec5754e
commit d796e7d491
6 changed files with 13 additions and 3 deletions

View File

@@ -113,6 +113,8 @@ pipeline {
sh '''
bash -lc '
set -euo pipefail
# 每条流水线开头先强制回到 SCM 检出的干净提交,避免固定源码目录残留改动影响本次执行。
git reset --hard HEAD
requested_commit="${COMMIT_HASH:-}"
if [[ -n "${requested_commit}" ]]; then
# Jenkins 先按 SCM 配置完成 checkout如指定 commit再拉取远端引用并切到该提交构建。