From e7a30107278acb0d0e99fd66842d72646a4f8439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Tue, 19 May 2026 21:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0jenkins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index be7bd354d..30a21a39f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,7 +30,6 @@ pipeline { if (params.PROJECT_NAME == project) { dir("deliverables/${project}") { withMaven(globalMavenSettingsConfig: '426b9a25-aa0d-47d3-a24c-8abdfc4421ff', jdk: "JDK8") { - sh 'java -version' sh 'mvn clean package -Dmaven.test.skip=true' } } @@ -86,19 +85,14 @@ pipeline { ] def project = params.PROJECT_NAME def dir = composeDir[project] - def imageTag = env.BUILD_TAG.toLowerCase() - - sshagent(['agent-36-ssh']) { + withCredentials([usernamePassword(credentialsId: 'goojia-ssh', usernameVariable: 'SSH_USER', passwordVariable: 'SSH_PASS')]) { sh """ - ssh -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} ' + sshpass -p "\$SSH_PASS" ssh -o StrictHostKeyChecking=no \$SSH_USER@${DEPLOY_HOST} ' cd ${DEPLOY_BASE}/${dir} - # 拉取最新镜像 docker compose pull - # 重启对应服务(不影响其他服务) docker compose up -d --no-deps --force-recreate ${dir} - # 清理旧镜像 docker image prune -f '