From 3ef85aff02ff1b21bad3d9e974cdc2e1d7301664 Mon Sep 17 00:00:00 2001 From: Insub Kim Date: Fri, 6 Jun 2025 11:09:16 +0900 Subject: [PATCH] dasdasd --- Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1666b1c..4188d64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,8 +61,14 @@ pipeline { script { // 현재 Nginx가 바라보고 있는 포트를 배포 서버에서 가져옴 def nginxConfPath = "/etc/nginx/sites-available/frovide.conf" // Nginx 설정 파일 경로 - def currentActivePortOutput = sh(script: "ssh ${env.DEPLOY_USER}@${env.DEPLOY_HOST} 'grep -oP \"server 127.0.0.1:\\\\K[0-9]+\" ${nginxConfPath} | head -n 1'", returnStdout: true).trim() - + // 수정된 부분: "ssh ${env.DEPLOY_USER}@${env.DEPLOY_HOST}" 부분을 제거 + // sshagent 블록 내에서 실행되므로, 이 명령은 이미 원격 서버에서 실행되는 것처럼 동작합니다. + def currentActivePortOutput = sh( + script: """ + ssh -o StrictHostKeyChecking=no ${env.DEPLOY_USER}@${env.DEPLOY_HOST} "grep -oP \\"server 127.0.0.1:\\\\K[0-9]+\\" ${nginxConfPath} | head -n 1" + """, + returnStdout: true + ).trim() if (currentActivePortOutput == "") { // 초기 배포이거나 Nginx 설정에 활성화된 포트가 없는 경우 env.ACTIVE_PORT = env.PORT_A // 첫 배포 시 PORT_A를 활성 포트로 가정