Create new build pipeline

Create new build pipeline #

NOTE: All description below only for on-hosted Build VM.

Pre requirements #

Dynamics 365 Finance and Operations Tools #

We should setup extension for Azure DevOps - Dynamics 365 Finance and Operations Tools From Market place site or from Azure DevOps Market place site

Azure DevOps

Generate Release Notes (Crossplatform) #

Generate Release Notes (Crossplatform) Generate Release Notes

Create new pipeline #

Go to Azure DevOps, Pipelines, Pipelines, create new pipeline. Select Use the classic editor to create a pipeline without YAML. Create new pipeline

Select source Select a source

and path for code in this source Select CVS path

Select Empty job template Select template

Give good name for yor template (1) and select proper Agent pool (2) Select template

Agent pools (we can create own list of pools for our needs, but now we will look standard cases):

  • Azure pipeline - VM MS managed, need to setup all dependencyes and we have limited free minutes for this pool
  • Default - client managed VM setup like Build VM

Setup property #

Trigers tabpage - setup schedule Select template

Options tabpage Option tabpage

  1. Some human readable description
  2. Build format $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
  3. Increase timeout from 60 to 720 minutes
  4. Add demands DynamicsSDK package

Pipeline tasks #

Get sources Get sources

  1. Setup Clean = true, Clean options = Sources
  2. Label sources = Always, Label format = $(build.buildNumber)

Agent job 1 propertyes Agent job 1 propertyes

Jobs #

Need to add few more steps for run pipeline Add new job

Prepare for build #

Add Powershell script with propertyes Prepare for build

  1. Display name = Prepare for build
  2. Type\File path = $(DynamicsSDK)\PrepareForBuild.ps1
  3. Arguments = -DatabaseBackupToRestore "$(DatabaseBackupToRestore)" -Verbose
  4. Advanced\Fail on Standard Error = True

Set Model Versions #

Add Powershell script with propertyes Set Model Versions

  1. Display name = Set Model Versions
  2. Type\File path = $(DynamicsSDK)\UpdateModelBuildNumbers.ps1
  3. Arguments = -BuildMetadataPath "$(Build.SourcesDirectory)\Metadata" -BuildNumber "$(Build.BuildNumber)" -ModelExclusions "$(ModelVersionExclusions)"
  4. Advanced\Fail on Standard Error = True

Build the solution #

Add MSBuild script with propertyes Build the solution

  1. Display name = Build the solution
  2. Project = $/Name of implementation project/Trunk/DEV/AXModulesBuild.proj
  3. MSBuild Version = Latest
  4. MSBuild Architecture = MSBuild x64
  5. Platform = $(BuildPlatform)
  6. Configuration = $(BuildConfiguration)
  7. MSBuild Arguments = /p:OutputPath="$(Agent.BuildDirectory)\Bin" /p:LogPath="$(Agent.BuildDirectory)\Logs", Clean = True
  8. Advanced\Record Project Details = True
  9. Control Options\Enabled = True

Database Sync #

Add MSBuild script with propertyes Database Sync

  1. Display name = Database Sync
  2. Project = $(DynamicsSDK)\Metadata\SyncEngine.proj
  3. MSBuild Version = Latest
  4. MSBuild Architecture = MSBuild x64
  5. Platform = $(BuildPlatform)
  6. Configuration = $(BuildConfiguration)
  7. MSBuild Arguments = /p:OutputPath="$(Agent.BuildDirectory)\Bin" /p:LogPath="$(Agent.BuildDirectory)\Logs" /p:FallbackToNative="$(SyncEngineFallbackToNative)" /p:GenerateEntityMapping="$(GenerateEntityMapping)"
  8. Advanced\Record Project Details = True
  9. Control Options\Enabled = True

Deploy Reports #

Add Powershell script with propertyes Deploy Reports

  1. Display name = Deploy Reports
  2. Type\File path = $(DynamicsSDK)\DeploySSRSReports.ps1
  3. Arguments = -DeployReports:([bool]$(DeployReports)) -Verbose
  4. Advanced\Fail on Standard Error = True
  5. Control Options\Enabled = True

Create Deployable Package #

Add Create Deployable Package step with propertyes Create Deployable Package

  1. Display name = Create Deployable Package
  2. X++ Tools Path = K:\AOSService\PackagesLocalDirectory\Bin
  3. Location of the X++ binaries to package = $(Agent.BuildDirectory)\Bin
  4. Search pattern for binaries to package = * $(Build.SourcesDirectory)\Metadata\SISPayroll_ISV* $(Build.SourcesDirectory)\Metadata\SISPayrollOps* $(Build.SourcesDirectory)\Metadata\SISPCMBI* $(Build.SourcesDirectory)\Metadata\SISMops* $(Build.SourcesDirectory)\Metadata\SISProject360* - list of binary packages in MCM solution
  5. Filename and path for the deployable package = $(Build.ArtifactStagingDirectory)\Packages\AXDeployableRuntime_$(Build.BuildNumber).zip
  6. Control Options\Enabled = True

Add Licenses to Deployable Package #

Add Add Licenses to Deployable Package step with propertyes Add Licenses to Deployable Package

  1. Display name = Add Licenses to Deployable Package
  2. Search pattern for license file to add to the package = $(Build.SourcesDirectory)/Licenses/*.txt
  3. Filename and path of the deployable package to update = $(Build.ArtifactStagingDirectory)\AXDeployableRuntime_$(Build.BuildNumber).zip
  4. Control Options\Enabled = True

NOTE: On our project we use PCM module very often. We should place license code to the package. Folder with license code can be placed on local Build VM or in source control system in separate forled (preferred and described here)

Generate Release Notes based on Release Comparison API #

Add Generate Release Notes (Crossplatform) step with propertyes (example of release note simple and full Generate Release Notes based on Release Comparison API

  1. Display name = Generate Release Notes based on Release Comparison API
  2. Output file = $(Build.ArtifactStagingDirectory)\ReleaseNote_$(Build.BuildNumber).txt
  3. Template Location = InLine
  4. Template =
This is the latest build and contains the following items:
{{#forEach this.workItems}}
{{#if isFirst}}WorkItems {{/if}}
* {{this.id}} {{lookup this.fields 'System.Title'}}
{{/forEach}}

Build {{buildDetails.buildNumber}}
Branch {{buildDetails.sourceBranch}}
  1. Replace the output file = True
  2. Control Options\Enabled = True

Publish Artifact: Packages #

Add Publish build artifacts step with propertyes Publish build artifacts

  1. Display name = Publish Artifact: Packages
  2. Path to publish = $(Build.ArtifactStagingDirectory)\Packages
  3. Artifact name = Packages
  4. Artifact publish location = Azure Pipelines
  5. Control Options\Enabled = True

Test Setup #

Add Powershell script with propertyes Test Setup

  1. Display name = Test Setup
  2. Type\File path = $(DynamicsSDK)\Test\TestStart.ps1
  3. Arguments = -BuildNumber "$(Build.SourceBranch)@$(Build.BuildNumber)"
  4. Advanced\Fail on Standard Error = True
  5. Control Options\Enabled = True, Continue on error = True

Execute Tests #

Add Visual Studio Test script with propertyes Execute Tests

  1. Display name = Execute Tests
  2. Select tests using = Test assemblies
  3. Test files = $(TestAssembly)
  4. Search folder = $(Agent.BuildDirectory)\Bin\
  5. Test results folder = $(Agent.TempDirectory)\TestResults
  6. Test filter criteria = $(TestFilter)
  7. Execution options\Select test platform using =Version. Test platform version = Visual Studio 2019, Code coverage enabled = True, Other console options = /Platform:X64 /InIsolation /UseVsixExtensions:true, Collect advanced diagnostics in case of catastrophic failures = True
  8. Advanced execution options\Automatically determined the batch size = True
  9. Reporting options\Test run title = Unit Test - $(Build.DefinitionName), Build platform = Build platform, Build configuration = $(BuildConfiguration), Upload test attachments = Tru

Test End #

Add Powershell script with propertyes Test End

  1. Display name = Test Setup
  2. Type\File path = $(DynamicsSDK)\Test\TestStart.ps1
  3. Arguments = -BuildNumber "$(Build.SourceBranch)@$(Build.BuildNumber)"
  4. Advanced\Fail on Standard Error = True
  5. Control Options\Enabled = True, Continue on error = True

Copy Files to: Staging Directory #

Add Copy files script with propertyes Copy Files to: Staging Directory

  1. Display name = Copy Files to: Staging Directory
  2. Source Folder = $(DynamicsSDK)\Test\TestStart.ps1
  3. Contents = Logs\**
  4. Target Folder = $(Build.ArtifactStagingDirectory)
  5. Control Options\Enabled = True

Publish Artifact: AdditionalLogs #

Add Publish build artifacts script with propertyes Copy Files to: Staging Directory

  1. Display name = Publish Artifact: AdditionalLogs
  2. Path to publish = $(Build.ArtifactStagingDirectory)\Logs
  3. Artifact name = AdditionalLogs
  4. Artifact publish location = Azure Pipelines
  5. Control Options\Enabled = True

Publish Artifact: Release note #

Add Publish build artifacts script with propertyes Copy Files to: Staging Directory

  1. Display name = Publish Artifact: Release note
  2. Path to publish = $(Build.ArtifactStagingDirectory)\ReleaseNote_$(Build.BuildNumber).txt
  3. Artifact name = Packages
  4. Artifact publish location = Azure Pipelines
  5. Control Options\Enabled = True
comments powered by Disqus