관리자 2 месяцев назад
Родитель
Сommit
7bcc37a45f
1 измененных файлов с 16 добавлено и 20 удалено
  1. 16 20
      Jenkinsfile

+ 16 - 20
Jenkinsfile

@@ -2,39 +2,35 @@ pipeline {
     agent any
     environment {
         DOTNET_CLI_TELEMETRY_OPTOUT = '1'
-        DEPLOY_API      = 'H:\\IIS\\bitforum-api'
-        DEPLOY_ADMIN    = 'H:\\IIS\\bitforum-admin'
+        DEPLOY_API   = '/mnt/h/iis/bitforum-api'
+        DEPLOY_ADMIN = '/mnt/h/iis/bitforum-admin'
     }
     stages {
-        stage('Backend Build') {
+        stage('Build') {
             steps {
-                bat 'dotnet publish Backend\\Web.Api -c Release -o publish\\api'
-                bat 'dotnet publish Backend\\Admin -c Release -o publish\\admin'
+                sh 'dotnet publish Backend/Web.Api -c Release -o publish/api'
+                sh 'dotnet publish Backend/Admin -c Release -o publish/admin'
             }
         }
         stage('Deploy API') {
             steps {
-                bat 'powershell.exe -ExecutionPolicy Bypass -File %DEPLOY_API%\\restart.ps1 stop'
-                bat 'timeout /t 3 /nobreak'
-                bat 'robocopy publish\\api %DEPLOY_API% /E /PURGE /XF web.config restart.ps1 || if %ERRORLEVEL% LEQ 7 exit 0'
-                bat 'powershell.exe -ExecutionPolicy Bypass -File %DEPLOY_API%\\restart.ps1 start'
+                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/api/ ${DEPLOY_API}/'
             }
         }
         stage('Deploy Admin') {
             steps {
-                bat 'powershell.exe -ExecutionPolicy Bypass -File %DEPLOY_ADMIN%\\restart.ps1 stop'
-                bat 'timeout /t 3 /nobreak'
-                bat 'robocopy publish\\admin %DEPLOY_ADMIN% /E /PURGE /XF web.config restart.ps1 || if %ERRORLEVEL% LEQ 7 exit 0'
-                bat 'powershell.exe -ExecutionPolicy Bypass -File %DEPLOY_ADMIN%\\restart.ps1 start'
+                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/admin/ ${DEPLOY_ADMIN}/'
+            }
+        }
+        stage('Restart Services') {
+            steps {
+                sh 'powershell.exe -ExecutionPolicy Bypass -File /mnt/h/iis/bitforum-api/restart.ps1'
+                sh 'powershell.exe -ExecutionPolicy Bypass -File /mnt/h/iis/bitforum-admin/restart.ps1'
             }
         }
     }
     post {
-        success {
-            echo 'bitForum-backend 배포 성공!'
-        }
-        failure {
-            echo 'bitforum-backend 배포 실패 - 기록을 확인하세요.'
-        }
+        success { echo 'Backend 배포 성공!' }
+        failure { echo 'Backend 배포 실패 - 로그를 확인하세요.' }
     }
-}
+}