fix: Fix Jenkinsfile syntax errors

- Fix indentation issues in pipeline stages
- Fix missing stage separation causing compilation error
- Ensure proper stage closure and formatting
- This resolves the 'Expected a stage @ line 131' error
This commit is contained in:
wangtianqi 2025-06-24 00:18:05 +08:00
parent 4d7b72d9e5
commit fea1b828ec

13
Jenkinsfile vendored
View File

@ -1,6 +1,7 @@
pipeline { pipeline {
agent any agent any
options {
options {
buildDiscarder(logRotator(numToKeepStr: '10')) buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 60, unit: 'MINUTES') // 增加到60分钟 timeout(time: 60, unit: 'MINUTES') // 增加到60分钟
timestamps() timestamps()
@ -10,7 +11,8 @@ pipeline {
// 使用系统默认或Jenkins节点上已安装的JDK // 使用系统默认或Jenkins节点上已安装的JDK
// 不再强制指定JAVA_HOME让Jenkins自动检测 // 不再强制指定JAVA_HOME让Jenkins自动检测
// 目标服务器配置 DEPLOY_SERVER = '116.62.163.84' // 目标服务器配置
DEPLOY_SERVER = '116.62.163.84'
// Docker相关环境变量 // Docker相关环境变量
IMAGE_NAME = 'jenkins-demo' IMAGE_NAME = 'jenkins-demo'
@ -121,8 +123,7 @@ pipeline {
""" """
echo "✅ SonarQube代码扫描完成" echo "✅ SonarQube代码扫描完成"
} catch (Exception e) { } catch (Exception e) { echo "⚠️ SonarQube扫描失败继续构建流程: ${e.getMessage()}"
echo "⚠️ SonarQube扫描失败继续构建流程: ${e.getMessage()}"
} }
} }
} }
@ -143,7 +144,9 @@ pipeline {
} }
} }
} }
} stage('构建Docker镜像') { }
stage('构建Docker镜像') {
steps { steps {
echo '🐳 构建Docker镜像...' echo '🐳 构建Docker镜像...'
script { script {