Adding stages to YAML pipelines

If no stages are defined in a YAML pipeline, there is always one implicit stage that holds all the jobs. To convert a pipeline into a multi-stage pipeline, you need to add the stages keyword and a list of stages, as shown in the following code:

stages:
- stage: stage1
displayName: My first stage
jobs:
- job: job1
steps:
- task: DotNetCoreCLI@2
displayName: ‘dotnet build’
inputs:
projects: '**/*.csproj'

- stage: stage2
jobs:
...

The preceding syntax shows that a list of stages is defined at the top of the YAML file. Each stage starts by defining a name. This name can be used later on so that you can refer to this stage.

While jobs (unless otherwise specified) run in parallel by default, stages always run sequentially by default. But just like jobs, stages accept the dependsOn and condition keywords to change the ordering, parallelism, and (potentially) to skip stages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.216.229