Ver Fonte

Update 'Jenkinsfile'

관리자 há 2 meses atrás
pai
commit
af65c3d743
1 ficheiros alterados com 12 adições e 11 exclusões
  1. 12 11
      Jenkinsfile

+ 12 - 11
Jenkinsfile

@@ -1,19 +1,21 @@
 pipeline {
-    agent any
+    agent { label 'windows-host' }
     environment {
         DOTNET_CLI_TELEMETRY_OPTOUT = '1'
-        DEPLOY_API   = '/mnt/h/bitforum-api/sources'
-        DEPLOY_ADMIN = '/mnt/h/bitforum-admin/sources'
     }
     stages {
+        stage('Checkout') {
+            steps {
+                checkout scm
+            }
+        }
         stage('Build') {
             steps {
-                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'
+                bat 'dotnet publish Web.Api -c Release -o publish\\api'
+                bat 'dotnet publish Admin -c Release -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'
@@ -22,16 +24,15 @@ pipeline {
         }
         stage('Deploy API') {
             steps {
-                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/api/ ${DEPLOY_API}/'
+                bat 'robocopy publish\\api H:\\IIS\\bitforum-api\\sources /MIR /XF web.config restart.ps1 /NFL /NDL /NP & if %ERRORLEVEL% LEQ 7 exit /b 0'
             }
         }
         stage('Deploy Admin') {
             steps {
-                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/admin/ ${DEPLOY_ADMIN}/'
+                bat 'robocopy publish\\admin H:\\IIS\\bitforum-admin\\sources /MIR /XF web.config restart.ps1 /NFL /NDL /NP & if %ERRORLEVEL% LEQ 7 exit /b 0'
             }
         }
         stage('Start Services') {
-            agent { label 'windows-host' }
             steps {
                 bat 'sc.exe start bitforum-Api'
                 bat 'sc.exe start bitforum-Admin'
@@ -39,7 +40,7 @@ pipeline {
         }
     }
     post {
-        success { echo 'Backend 배포 성공!' }
-        failure { echo 'Backend 배포 실패!' }
+        success { echo 'Backend deploy success!' }
+        failure { echo 'Backend deploy failed!' }
     }
 }