Commit 2b442278 authored by Auto Backup's avatar Auto Backup

feat: 添加诊断环境变量阶段,查看PATH和关键工具位置

parent ec362f68
......@@ -33,6 +33,73 @@ pipeline {
}
stages {
stage('诊断环境变量') {
steps {
script {
echo "=========================================="
echo " 诊断环境变量信息"
echo "=========================================="
// 1. 查看 Jenkins 认为的 PATH
echo "🔍 Jenkins env PATH:"
echo "${env.PATH}"
echo ""
// 2. Windows 进程真实的 PATH (不带缓存)
if (isUnix()) {
echo "🔍 Unix 系统 PATH:"
sh "echo \$PATH"
} else {
echo "🔍 Windows 真实 PATH:"
bat "echo %PATH%"
}
echo ""
// 3. 检查 git 在哪
echo "🔍 Git 可执行文件位置:"
if (isUnix()) {
sh "which git || echo 'git not found'"
sh "git --version || echo 'git not found'"
} else {
bat "where git"
}
echo ""
// 4. 检查 node 在哪
echo "🔍 Node.js 可执行文件位置:"
if (isUnix()) {
sh "which node || echo 'node not found'"
sh "node --version || echo 'node not found'"
} else {
bat "where node"
}
echo ""
// 5. 检查 pwsh 在哪 (PowerShell 7)
echo "🔍 PowerShell 7 (pwsh) 位置:"
if (isUnix()) {
sh "which pwsh || echo 'pwsh not found'"
} else {
bat "where pwsh"
}
echo ""
// 6. 检查 powershell 在哪 (PowerShell 5)
echo "🔍 PowerShell 5 (powershell) 位置:"
if (isUnix()) {
echo "Unix 系统无 powershell"
} else {
bat "where powershell"
}
echo ""
echo "=========================================="
echo " 诊断完成"
echo "=========================================="
}
}
}
stage('环境检测') {
steps {
script {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment