So I am able to create YAML only build pipelines (some of which also include release steps)
And these now work very well. We also have a selection of release pipelines which were built using the classic tasks
What I am thinking now is creating release pipelines using pure YAML but I cannot seem to get going on this. Is it possible or are we now expected to use pipelines for both build and release?
Any thoughts or ideas please?
There's no separation between builds and releases (aka deployments) in YAML pipelines.
You can use stages that represent different parts of your development cycle (e.g. build or deploy) and additionally organize it by environment (e.g. Dev, QA, Production) - for example:
YAML pipeline:
trigger: none
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Build
dependsOn: []
displayName: 'Build'
jobs:
- job: BuildJob # regular job, no environment (or approvals) required
displayName: 'Build Job'
steps:
- script: echo 'Building...'
displayName: 'Build Step'
- stage: DeployDev
displayName: 'Deploy to Dev'
dependsOn: Build
jobs:
- deployment: DeployDevJob # deployment job
displayName: 'Deploy to Dev job'
environment: 'Dev' # Approvers and other checks can be configured for the environment
strategy:
runOnce:
deploy:
steps:
- script: echo 'Deploying to Dev...'
displayName: 'Deploy to Dev Step'
- stage: DeployQA
displayName: 'Deploy to QA'
dependsOn: DeployDev
jobs:
- deployment: DeployQAJob # deployment job
displayName: 'Deploy to QA Job'
environment: 'QA' # Approvers and other checks can be configured for the environment
strategy:
runOnce:
deploy:
steps:
- script: echo 'Deploying to QA...'
displayName: 'Deploy to QA Step'
- stage: DeployProd
displayName: 'Deploy to Production'
dependsOn: DeployQA
jobs:
- deployment: DeployProdJob # deployment job
displayName: 'Deploy to Production Job'
environment: 'Production' # Approvers and other checks can be configured for the environment
strategy:
runOnce:
deploy:
steps:
- script: echo 'Deploying to Production...'
displayName: 'Deploy to Production Step'
In YAML pipelines, and as already mentioned in Shamrai's answer, it is recommend that you put your deployment steps in a special type of job called a deployment job. A deployment job is a collection of steps that are run sequentially against an Azure DevOps environment.
Different Checks and approvals can be configured for each environment.