Jenkinsfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. pipeline {
  2. agent any
  3. environment {
  4. DOTNET_CLI_TELEMETRY_OPTOUT = '1'
  5. DEPLOY_API = '/mnt/h/iis/bitforum-api/sources'
  6. DEPLOY_ADMIN = '/mnt/h/iis/bitforum-admin/sources'
  7. }
  8. stages {
  9. stage('Build') {
  10. steps {
  11. sh 'dotnet publish Web.Api -c Release -r win-x64 --self-contained false -o publish/api'
  12. sh 'dotnet publish Admin -c Release -r win-x64 --self-contained false -o publish/admin'
  13. }
  14. }
  15. stage('Stop Services') {
  16. agent { label 'windows-host' }
  17. steps {
  18. bat 'sc.exe stop bitforum-Api || exit 0'
  19. bat 'sc.exe stop bitforum-Admin || exit 0'
  20. bat 'ping 127.0.0.1 -n 6 > nul'
  21. }
  22. }
  23. stage('Deploy API') {
  24. steps {
  25. sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/api/ ${DEPLOY_API}/'
  26. }
  27. }
  28. stage('Deploy Admin') {
  29. steps {
  30. sh 'rsync -av --delete --exclude="web.config" --exclude="restart.ps1" publish/admin/ ${DEPLOY_ADMIN}/'
  31. }
  32. }
  33. stage('Start Services') {
  34. agent { label 'windows-host' }
  35. steps {
  36. bat 'sc.exe start bitforum-Api'
  37. bat 'sc.exe start bitforum-Admin'
  38. }
  39. }
  40. }
  41. post {
  42. success { echo 'Backend 배포 성공!' }
  43. failure { echo 'Backend 배포 실패!' }
  44. }
  45. }