Explorar o código

Merge branch 'main' of ssh://git.web.or.kr:9981/admin/bitforum-backend

KIM-JINO5 hai 2 meses
pai
achega
089042aa7e
Modificáronse 1 ficheiros con 18 adicións e 9 borrados
  1. 18 9
      Jenkinsfile

+ 18 - 9
Jenkinsfile

@@ -2,14 +2,22 @@ pipeline {
     agent any
     environment {
         DOTNET_CLI_TELEMETRY_OPTOUT = '1'
-        DEPLOY_API   = '/mnt/h/iis/bitforum-api'
-        DEPLOY_ADMIN = '/mnt/h/iis/bitforum-admin'
+        DEPLOY_API   = '/mnt/h/iis/bitforum-api/sources'
+        DEPLOY_ADMIN = '/mnt/h/iis/bitforum-admin/sources'
     }
     stages {
         stage('Build') {
             steps {
-                sh 'dotnet publish Web.Api -c Release -o publish/api'
-                sh 'dotnet publish Admin -c Release -o publish/admin'
+                sh 'dotnet publish Web.Api -c Release -r win-x64 --self-contained false -o publish/api'
+                sh 'dotnet publish Admin -c Release -r win-x64 --self-contained false -o publish/admin'
+            }
+        }
+        stage('Stop Services') {
+            agent { label 'windows-host' }
+            steps {
+                bat 'sc.exe stop bitforum-Api || exit 0'
+                bat 'sc.exe stop bitforum-Admin || exit 0'
+                bat 'ping 127.0.0.1 -n 6 > nul'
             }
         }
         stage('Deploy API') {
@@ -22,15 +30,16 @@ pipeline {
                 sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/admin/ ${DEPLOY_ADMIN}/'
             }
         }
-        stage('Restart Services') {
+        stage('Start Services') {
+            agent { label 'windows-host' }
             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'
+                bat 'sc.exe start bitforum-Api'
+                bat 'sc.exe start bitforum-Admin'
             }
         }
     }
     post {
         success { echo 'Backend 배포 성공!' }
-        failure { echo 'Backend 배포 실패 - 로그를 확인하세요.' }
+        failure { echo 'Backend 배포 실패!' }
     }
-}
+}