Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cpas6-install
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李金钢
cpas6-install
Commits
2b442278
Commit
2b442278
authored
Mar 19, 2026
by
Auto Backup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加诊断环境变量阶段,查看PATH和关键工具位置
parent
ec362f68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
environment-check.Jenkinsfile
environment-check.Jenkinsfile
+67
-0
No files found.
environment-check.Jenkinsfile
View file @
2b442278
...
...
@@ -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 {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment