...
In Azure DevOps, expand Pipelines on the left hand menu, and click Builds.
Click New, then click New build pipeline.
Click Use the visual designer.
Note: In the long term, we should use the YAML editor to define build pipelines, so that our pipelines are implemented as infrastructure as code. This will require trial and error with our pipelines and a better undersrtanding of how to script with YAML.
Choose the feature branch from the dropdown list of branches, and click Continue.
Choose the appropriate template from the list. In this example, the feature is an ASP.NET web app that will be deployed to an Azure App Service.
In the Pipeline blade, specify the Name for the pipeline. and the Visual Studio Solution to build. From the Azure subscription dropdown list, choose the service connection for the resource group to which the app will be deployed (see above). Choiose the App service name (the app service must already exist in the Azure subscription).
On the Triggers tab, in the Continuous integration blade, click Add under Path filters, and specify the folder that contains the components that comprise the feature. We want this pipeline to run when changes are made to this feature, but not when changes are made to other features.
Click Save & queue.
On the Save build pipeline and queue dialog, enter a Save comment and Commit comment, and click Save & queue.
...
Here is the YAML that defines this pipeline:
Code Block | |||
---|---|---|---|
|
...
| |
resources:
- repo: self
pool:
vmImage: Hosted VS2017
demands:
- msbuild
- visualstudio
- vstest
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution UserStory/UserStory.sln'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSTest@2
displayName: 'VsTest - testAssemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: AzureRmWebAppDeployment@4
displayName: 'Azure App Service Deploy: tc-dev-user-story'
inputs:
azureSubscription: '$(Parameters.connectedServiceName)'
WebAppName: '$(Parameters.WebAppName)'
packageForLinux: '$(build.artifactstagingdirectory)/**/*.zip'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)' |