Pipeline Coding Standards · DEVOPS-01
This document provides standards on creating and maintaining effective DevOps Pipelines.
Use YAML pipelines · DEVOPS-01.1 · MUST · DEV/TEST
Always use YAML (YAML Ain’t Markup Language) when creating DevOps pipelines.
Use lower, kebab case for file name, e.g. 'build-app.job.yaml'. · DEVOPS-01.2 · MUST · DEV/TEST
Always use lower, kebab case for file name. For example: build-app.job.yaml
Use Pascal, snake case for IDs, including the type, e.g. 'Job_Build_App'. · DEVOPS-01.3 · MUST · DEV/TEST
Always use Pascal, snake case for IDs, including the type. For example: Job_Build_App
Include a blank line between steps. · DEVOPS-01.4 · MUST · DEV/TEST
Always include a blank line between steps.
steps:
- task: PowerShell@2
inputs:
targetType: inline
script: Write-Host "Hello world"
- task: PowerShell@2
inputs:
targetType: inline
script: Write-Host "Goodbye world"Batch changes when using the CI trigger. · DEVOPS-01.5 · MUST · DEV
Always batch changes when using the CI trigger.
Include an approval gate for deployments to customer-facing environments. · DEVOPS-01.6 · MUST · DEV/TEST
Always include an approval gate for deployments to customer-facing environments. View documentation
Use folders to group pipelines. · DEVOPS-01.10 · MUST · DEV/TEST
Always use a sensible folder structure for grouping pipelines (e.g., /deployment or /testing)
Include an approval gate for deployments to internal environments. · DEVOPS-01.7 · SHOULD · DEV/TEST
It is strongly recommended that you include an approval gate for deployments to internal environments.
Split stages and jobs into their own file. · DEVOPS-01.8 · SHOULD · DEV/TEST
It is strongly recommended that you split stages and jobs into their own file.
Include explicit 'Use Node' and 'Use .NET' steps. · DEVOPS-01.9 · SHOULD · DEV/TEST
It is strongly recommended that you include explicit Use Node and Use .NET steps.
# Use Node.js ecosystem v1
# Set up a Node.js environment and add it to the PATH, additionally providing proxy support.
- task: UseNode@1
inputs:
#version: '10.x' # string. Version. Default: 10.x.
#checkLatest: false # boolean. Check for Latest Version. Default: false.
#force32bit: false # boolean. Use 32 bit version on x64 agents. Default: false.
# advanced
#retryCountOnDownloadFails: '5' # string. Set retry count when nodes downloads failed. Default: 5.
#delayBetweenRetries: '1000' # string. Set delay between retries. Default: 1000.# Use .NET Core v2
# Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
- task: UseDotNet@2
inputs:
#packageType: 'sdk' # 'runtime' | 'sdk'. Package to install. Default: sdk.
#useGlobalJson: false # boolean. Optional. Use when packageType = sdk. Use global json. Default: false.
#workingDirectory: # string. Optional. Use when useGlobalJson = true. Working Directory.
#version: # string. Optional. Use when useGlobalJson = false || packageType = runtime. Version.
#includePreviewVersions: false # boolean. Optional. Use when useGlobalJson = false || packageType = runtime. Include Preview Versions. Default: false.
# Advanced
#vsVersion: # string. Compatible Visual Studio version.
#installationPath: '$(Agent.ToolsDirectory)/dotnet' # string. Path To Install .Net Core. Default: $(Agent.ToolsDirectory)/dotnet.
#performMultiLevelLookup: false # boolean. Perform Multi Level Lookup. Default: false.