Multi-job pipelines

The pipeline you saw in the previous section does not specify any jobs, as you may recall from the section on classic builds. Instead, it contains a list of tasks under the steps keyword. This means that it implicitly contains only a single job. With YAML pipelines, it is also possible to create a definition that contains more than one job. To do this, the following structure can be used:

trigger: 
- master

pool:
name: Azure Pipelines
vmImage: windows-2019

jobs:
- job: job1
displayName: A pretty name for job1
steps:
- task: DotNetCoreCLI@2
...
- job: job2
displayName: My second job
pool:
name: Azure Pipelines
vmImage: ubuntu-18.04
...

Instead of adding the steps keyword directly to the pipeline, first, a list of jobs is created. Within that list, one or more job keywords are added, followed by the name for that job. Next to this technical name, a display name (displayName) can be specified for each job.

As the second job in this example shows, it is also possible to specify which agent pool to use per job. When no pool is specified for a job, the default pool specified at the top of the file is used.

The jobs that are discussed in this section are called agent jobs. Besides agent jobs, there are also server jobs, container jobs, and deployment jobs available. More information about these types of jobs can be found at https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases#types-of-jobs.

By default, all the jobs in a pipeline run in parallel, but there are control options available to change this.

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

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