dasdasd
Some checks failed
main-branch-frovide/pipeline/head There was a failure building this commit

This commit is contained in:
Insub Kim 2025-06-06 11:09:16 +09:00
parent 0c14d6512a
commit 3ef85aff02

10
Jenkinsfile vendored
View File

@ -61,8 +61,14 @@ pipeline {
script { script {
// 현재 Nginx가 바라보고 있는 포트를 배포 서버에서 가져옴 // 현재 Nginx가 바라보고 있는 포트를 배포 서버에서 가져옴
def nginxConfPath = "/etc/nginx/sites-available/frovide.conf" // 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 == "") { if (currentActivePortOutput == "") {
// 초기 배포이거나 Nginx 설정에 활성화된 포트가 없는 경우 // 초기 배포이거나 Nginx 설정에 활성화된 포트가 없는 경우
env.ACTIVE_PORT = env.PORT_A // 첫 배포 시 PORT_A를 활성 포트로 가정 env.ACTIVE_PORT = env.PORT_A // 첫 배포 시 PORT_A를 활성 포트로 가정