Kaynağa Gözat

Update 'Jenkinsfile'

관리자 2 ay önce
ebeveyn
işleme
b4229e7624
1 değiştirilmiş dosya ile 10 ekleme ve 6 silme
  1. 10 6
      Jenkinsfile

+ 10 - 6
Jenkinsfile

@@ -1,33 +1,37 @@
 pipeline {
-    agent { label 'windows-host' }
+    agent any
     environment {
         DOTNET_CLI_TELEMETRY_OPTOUT = '1'
+        DEPLOY_API   = '/mnt/h/iis/bitforum-api/sources'
+        DEPLOY_ADMIN = '/mnt/h/iis/bitforum-admin/sources'
     }
     stages {
         stage('Build') {
             steps {
-                bat 'dotnet publish Web.Api -c Release -o publish\\api'
-                bat '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'
+                bat 'timeout /t 5 /nobreak'
             }
         }
         stage('Deploy API') {
             steps {
-                bat 'robocopy publish\\api H:\\IIS\\bitforum-api\\sources /E /PURGE /XF web.config restart.ps1 & if %ERRORLEVEL% LEQ 7 exit 0'
+                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/api/ ${DEPLOY_API}/'
             }
         }
         stage('Deploy Admin') {
             steps {
-                bat 'robocopy publish\\admin H:\\IIS\\bitforum-admin\\sources /E /PURGE /XF web.config restart.ps1 & if %ERRORLEVEL% LEQ 7 exit 0'
+                sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/admin/ ${DEPLOY_ADMIN}/'
             }
         }
         stage('Start Services') {
+            agent { label 'windows-host' }
             steps {
                 bat 'sc.exe start bitforum-Api'
                 bat 'sc.exe start bitforum-Admin'