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 '