Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Created July 27, 2019 19:56
Show Gist options
  • Save goyalmohit/2dd3915102d5769049298315fba49145 to your computer and use it in GitHub Desktop.
Save goyalmohit/2dd3915102d5769049298315fba49145 to your computer and use it in GitHub Desktop.
stages:
- stage: Build_Source_Code # Build Source Code for Dotnet Core Web App
jobs:
- job: Build
pool: 'Hosted VS2017'
variables:
buildConfiguration: 'Release'
continueOnError: false
steps:
- task: DotNetCoreCLI@2
inputs:
command: build
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: publish
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
modifyOutputPath: true
zipAfterPublish: true
- task: PublishBuildArtifacts@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifact: drop
- stage: Run_Unit_tests # Run Unit tests in the Source code
jobs:
- job: Tests
pool: 'Hosted VS2017'
variables:
buildConfiguration: 'Release'
continueOnError: true
steps:
- task: DotNetCoreCLI@2
inputs:
command: test
projects: dotnetcore-tests
arguments: '--configuration $(buildConfiguration) --logger trx'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- stage: Deploy_In_Dev # Deploy artifacts to the dev environment
jobs:
- deployment: azure_web_app_dev
pool: 'Hosted VS2017'
variables:
WebAppName: 'multistage-yaml-dev'
environment: 'dev-environment'
strategy:
runOnce:
deploy:
steps:
- task: AzureRMWebAppDeployment@4
displayName: Azure App Service Deploy
inputs:
WebAppKind: webApp
ConnectedServiceName: 'pay-as-you-go'
WebAppName: $(WebAppName)
Package: $(System.WorkFolder)/**/*.zip
- stage: Deploy_In_QA # Deploy artifacts to the qa environment
jobs:
- deployment: azure_web_app_qa
pool: 'Hosted VS2017'
variables:
WebAppName: 'multistage-yaml-qa'
environment: 'qa-environment'
strategy:
runOnce:
deploy:
steps:
- task: AzureRMWebAppDeployment@4
displayName: Azure App Service Deploy
inputs:
WebAppKind: webApp
ConnectedServiceName: 'pay-as-you-go'
WebAppName: $(WebAppName)
Package: $(System.WorkFolder)/**/*.zip
- stage: Deploy_In_Prod # Deploy artifacts to the production environment
jobs:
- deployment: azure_web_app_prod
pool: 'Hosted VS2017'
variables:
WebAppName: 'multistage-yaml'
environment: 'prod-environment'
strategy:
runOnce:
deploy:
steps:
- task: AzureRMWebAppDeployment@4
displayName: Azure App Service Deploy
inputs:
WebAppKind: webApp
ConnectedServiceName: 'pay-as-you-go'
WebAppName: $(WebAppName)
Package: $(System.WorkFolder)/**/*.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment