1 | initial version |
Azure Pipelines allows running multiple tasks simultaneously within a single job by defining multiple parallel jobs in the pipeline. These jobs can run in parallel on different agents or on the same agent using multiple threads. To define parallel jobs, follow these steps:
Here's an example YAML definition for running two tasks in parallel:
jobs:
- job: ParallelJob
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
python:
- '3.6'
- '3.7'
node:
- '10.x'
- '12.x'
steps:
- task: PythonTask
displayName: 'Run Python Tests'
inputs:
versionSpec: '$(python)'
- task: NodeTask
displayName: 'Run Node Tests'
inputs:
versionSpec: '$(node)'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
In this example, two parallel jobs are defined based on the matrix strategy for Python and Node.js versions. The PythonTask and NodeTask are executed in parallel on the specified agents, and the results are published using the PublishTestResults task.