Every development team has unique requirements that can make implementing an efficient deployment pipeline difficult on any cloud service. This is a process to prevents downtime:
Here is CICD script:
variables:
MSBUILD: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\msbuild.exe"
SOLUTION: IProcessorSolution.sln
WEBJOB_PROJECT: ".\\IProcessorPdfParser\\IProcessorPdfParser.csproj"
DEV_PUBLISH_PROFILE: "IProcessorWebsiteStaging - Web Deploy"
DEV_PUBLISH_PROFILE_WEBJOB_PROJECT: "IProcessorWebsiteStaging - Web Deploy.pubxml"
DEV_DR_PUBLISH_PROFILE: "iprocessorwebsitestaging-dr - Web Deploy"
DEV_DR_PUBLISH_PROFILE_WEBJOB_PROJECT: "iprocessorwebsitestaging-dr - Web Deploy.pubxml"
PROD_DR_PUBLISH_PROFILE: "iprocessorwebsite-dr - Web Deploy"
PROD_DR_PUBLISH_PROFILE_WEBJOB_PROJECT: "iprocessorwebsite-dr - Web Deploy.pubxml"
stages:
- build
- deploy
deploy_dev_dr:
stage: deploy
environment:
name: staging
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != "dev" && $CI_COMMIT_BRANCH != "master"
tags:
- shared-windows
- windows
- windows-1809
script:
- 'nuget restore $SOLUTION'
- '& $MSBUILD $SOLUTION /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$DEV_DR_PUBLISH_PROFILE'
- '& $MSBUILD $WEBJOB_PROJECT /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$DEV_DR_PUBLISH_PROFILE_WEBJOB_PROJECT'
artifacts:
expire_in: 1 week
deploy_dev:
stage: deploy
environment:
name: staging
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "dev"
tags:
- shared-windows
- windows
- windows-1809
script:
- 'nuget restore $SOLUTION'
- '& $MSBUILD $SOLUTION /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$DEV_PUBLISH_PROFILE'
- '& $MSBUILD $WEBJOB_PROJECT /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$DEV_PUBLISH_PROFILE_WEBJOB_PROJECT'
artifacts:
expire_in: 1 week
deploy_prod:
stage: deploy
environment:
name: production
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"
tags:
- shared-windows
- windows
- windows-1809
script:
- 'nuget restore $SOLUTION'
- '& $MSBUILD $SOLUTION /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$PROD_DR_PUBLISH_PROFILE'
- '& $MSBUILD $WEBJOB_PROJECT /p:Configuration=Release /p:SignManifests=False /p:DeployOnBuild=true /p:PublishProfile=$PROD_DR_PUBLISH_PROFILE_WEBJOB_PROJECT'
artifacts:
expire_in: 1 week