관리자 2 месяцев назад
Родитель
Сommit
508111f28a
1 измененных файлов с 11 добавлено и 3 удалено
  1. 11 3
      Jenkinsfile

+ 11 - 3
Jenkinsfile

@@ -11,6 +11,14 @@ pipeline {
                 sh 'dotnet publish Web.Api -c Release -r win-x64 --self-contained true -o publish/api'
                 sh 'dotnet publish Admin -c Release -r win-x64 --self-contained true -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 'timeout /t 5 /nobreak'
+            }
         }
         stage('Deploy API') {
             steps {
@@ -22,11 +30,11 @@ 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 {
-                bat 'powershell.exe -ExecutionPolicy Bypass -File H:\\IIS\\bitforum-api\\restart.ps1'
-                bat 'powershell.exe -ExecutionPolicy Bypass -File H:\\IIS\\bitforum-admin\\restart.ps1'
+                bat 'sc.exe start bitforum-Api'
+                bat 'sc.exe start bitforum-Admin'
             }
         }
     }