Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. In Azure DevOps, expand Pipelines on the left hand menu, and click Builds.

  2. Click New, then click New build pipeline.

  3. 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.

  4. Choose the feature branch from the dropdown list of branches, and click Continue.

  5. 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.

    Image Modified

  6. 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).

    Image Modified

  7. 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.

    Image Modified

  8. Click Save & queue.

  9. 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
breakoutModewide
language

...

text
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)'