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
d3f046f9
Commit
d3f046f9
authored
Mar 19, 2026
by
Auto Backup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加专门的环境检测Jenkinsfile,只包含AGENT_LABEL参数和环境检测功能
parent
2ae80615
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
environment-check.Jenkinsfile
environment-check.Jenkinsfile
+56
-0
No files found.
environment-check.Jenkinsfile
0 → 100644
View file @
d3f046f9
// 新增带返回值的跨平台 PowerShell 执行函数
def runPowerShellWithOutput(script) {
try {
if (isUnix()) {
return sh(script: "pwsh -Command \"${script}\"", returnStdout: true).trim()
} else {
return powershell(script: script, returnStdout: true).trim()
}
} catch (Exception e) {
echo "执行 PowerShell 脚本失败: ${e.message}"
throw e
}
}
pipeline {
parameters {
string(
name: 'AGENT_LABEL',
defaultValue: 'windowsPackageMachine',
description: '输入 agent 节点 (可选:ljgWinMachine or lzxWinMachine)'
)
}
agent {
label params.AGENT_LABEL
}
stages {
stage('环境检测') {
steps {
script {
try {
echo "🚀 开始运行环境检测..."
// 使用新创建的环境检测脚本
def envCheckResult = runPowerShellWithOutput("node ./check-environment.js")
echo "环境检测结果:"
echo envCheckResult
// 如果脚本返回非零退出码,这里会抛出异常
// 所以我们不需要额外检查
} catch (Exception e) {
echo "环境检测阶段发生错误: ${e.message}"
echo "⚠️ 环境检测失败,请确保以下组件已安装:"
echo "1. Node.js (https://nodejs.org/)"
echo "2. ss3ops (会自动安装,如失败请手动安装)"
currentBuild.result = 'FAILURE'
error("环境检测失败: ${e.message}")
}
}
}
}
}
}
\ No newline at end of file
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