From fea1b828ecb5d154beb398dadd2696042678d865 Mon Sep 17 00:00:00 2001 From: wangtianqi <1350217033@qq.com> Date: Tue, 24 Jun 2025 00:18:05 +0800 Subject: [PATCH] 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 --- Jenkinsfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9db13e9..b273aae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,7 @@ pipeline { agent any - options { + + options { buildDiscarder(logRotator(numToKeepStr: '10')) timeout(time: 60, unit: 'MINUTES') // 增加到60分钟 timestamps() @@ -10,7 +11,8 @@ pipeline { // 使用系统默认或Jenkins节点上已安装的JDK // 不再强制指定JAVA_HOME,让Jenkins自动检测 - // 目标服务器配置 DEPLOY_SERVER = '116.62.163.84' + // 目标服务器配置 + DEPLOY_SERVER = '116.62.163.84' // Docker相关环境变量 IMAGE_NAME = 'jenkins-demo' @@ -121,8 +123,7 @@ pipeline { """ echo "✅ SonarQube代码扫描完成" - } catch (Exception e) { - echo "⚠️ SonarQube扫描失败,继续构建流程: ${e.getMessage()}" + } catch (Exception e) { echo "⚠️ SonarQube扫描失败,继续构建流程: ${e.getMessage()}" } } } @@ -143,7 +144,9 @@ pipeline { } } } - } stage('构建Docker镜像') { + } + + stage('构建Docker镜像') { steps { echo '🐳 构建Docker镜像...' script {