pipeline definition
A pipeline is one or more stages that describe a CI/CD process.
A pipeline is one or more jobs that describe a CI/CD process.
Overloads
| Overload | Description |
|---|---|
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
| Overload | Description |
|---|---|
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
| Overload | Description |
|---|---|
| pipeline: stages | Pipeline with stages. |
| pipeline: extends | Pipeline that extends a template. |
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
| Overload | Description |
|---|---|
| pipeline: stages | Pipeline with stages. |
| pipeline: extends | Pipeline that extends a template. |
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
| Overload | Description |
|---|---|
| pipeline: stages | Pipeline with stages. |
| pipeline: extends | Pipeline that extends a template. |
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
| Overload | Description |
|---|---|
| pipeline: stages | Pipeline with stages. |
| pipeline: extends | Pipeline that extends a template. |
| pipeline: jobs | Pipeline with jobs and one implicit stage. |
| pipeline: steps | Pipeline with steps and one implicit job. |
Remarks
A pipeline is one or more stages that describe a CI/CD process. Stages are the major divisions in a pipeline. The stages "Build this app," "Run these tests," and "Deploy to preproduction" are good examples.
A stage is one or more jobs, which are units of work assignable to the same machine. You can arrange both stages and jobs into dependency graphs. Examples include "Run this stage before that one" and "This job depends on the output of that job."
A job is a linear series of steps. Steps can be tasks, scripts, or references to external templates.
This hierarchy is reflected in the structure of a YAML file like:
- Pipeline
- Stage A
- Job 1
- Step 1.1
- Step 1.2
- ...
- Job 2
- Step 2.1
- Step 2.2
- ...
- Job 1
- Stage B
- ...
- Stage A
Simple pipelines don't require all of these levels. For example, in a single-job build you can omit the containers for stages and jobs because there are only steps. And because many options shown in this article aren't required and have good defaults, your YAML definitions are unlikely to include all of them.
A pipeline is one or more jobs that describe a CI/CD process. A job is a unit of work assignable to the same machine. You can arrange jobs into dependency graphs like "This job depends on the output of that job."
A job is a linear series of steps. Steps can be tasks, scripts, or references to external templates.
This hierarchy is reflected in the structure of a YAML file like:
- Pipeline
- Job 1
- Step 1.1
- Step 1.2
- ...
- Job 2
- Step 2.1
- Step 2.2
- ...
- Job 1
For single-job pipelines, you can omit the jobs container because there are only steps. And because many options shown in this article aren't required and have good defaults, your YAML definitions are unlikely to include all of them.
If you have a single stage, you can omit the stages keyword and directly specify the jobs keyword:
# ... other pipeline-level keywords
jobs: [ job | templateReference ]
If you have a single stage and a single job, you can omit the stages and jobs keywords and directly specify the steps keyword:
# ... other pipeline-level keywords
steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
If you have a single job, you can omit the jobs keyword and directly specify the steps keyword:
# ... other pipeline-level keywords
steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
Use the name property to configure the pipeline run number. For more information, see Configure run or build numbers.
pipeline: jobs
You can provide a list of jobs to define a pipeline with a single implicit stage.
jobs: [ job ]
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
pr: pr # Pull request triggers
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
variables: variables # Variables for this pipeline
parameters:
string: string # Name/value pairs.
Properties
jobs
name
string_allowExpressions
Pipeline run number.trigger
pr
resources
variables
parameters
string name/value pairs
jobs: [ job ]
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
pr: pr # Pull request triggers
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
variables: variables # Variables for this pipeline
parameters:
string: string # Name/value pairs.
Properties
jobs
name
string_allowExpressions
Pipeline run number.trigger
pr
resources
variables
parameters
string name/value pairs
jobs: [ job | deployment | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
jobs
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
jobs: [ job | deployment | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
jobs
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
jobs: [ job | deployment | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
jobs
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.jobs: [ job | deployment | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
jobs
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.Examples
trigger:
- main
pool:
vmImage: ubuntu-latest
jobs:
- job: PreWork
steps:
- script: "Do pre-work"
- job: PostWork
pool: windows-latest
steps:
- script: "Do post-work using a different hosted image"
pipeline: steps
You can provide a list of steps to define a pipeline with a single implicit job and stage.
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template | restoreCache | saveCache ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Scorch the repo before fetching?. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
pr: pr # Pull request triggers
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
variables: variables # Variables for this pipeline
parameters:
string: string # Name/value pairs.
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
pr
resources
variables
parameters
string name/value pairs
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | publish | template | restoreCache | saveCache ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
container: jobContainer # Container resource name
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Scorch the repo before fetching?. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
pr: pr # Pull request triggers
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
variables: variables # Variables for this pipeline
parameters:
string: string # Name/value pairs.
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
container
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
pr
resources
variables
parameters
string name/value pairs
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | restoreCache | saveCache | reviewApp ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
container: jobContainer # Container resource name
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Which parts of the workspace should be scorched before fetching. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
container
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | restoreCache | saveCache | reviewApp ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
container: jobContainer # Container resource name
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Which parts of the workspace should be scorched before fetching. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
container
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | restoreCache | saveCache | reviewApp ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
container: jobContainer # Container resource name
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Which parts of the workspace should be scorched before fetching. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
container
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | restoreCache | saveCache | reviewApp ]
strategy: jobStrategy # Execution strategy for this job
continueOnError: string # Continue running even on failure?.
pool: pool # Pool where this job will run
container: jobContainer # Container resource name
services: # Container resources to run as a service container.
string: string # Name/value pairs.
workspace: # Workspace options on the agent.
clean: string # Which parts of the workspace should be scorched before fetching. (outputs, resources, all)
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
strategy
continueOnError
boolean
Continue running even on failure?pool
container
services
string name/value pairs
Container resources to run as a service container.workspace
workspace options
Workspace options on the agent.steps
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.Examples
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- script: "Hello world!"
pipeline: stages
You can provide a list of stages to define a pipeline with multiple stages.
stages: [ stage | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
stages
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
stages: [ stage | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
stages
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
stages: [ stage | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
stages
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.stages: [ stage | template ]
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
stages
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.Examples
trigger:
- main
pool:
vmImage: ubuntu-latest
stages:
- stage: CI
jobs:
- job: CIWork
steps:
- script: "Do CI work"
- stage: Test
jobs:
- job: TestWork
steps:
- script: "Do test work"
pipeline: extends
Extends a pipeline using a template.
extends: # Required. Extends a template
template: string #
parameters: # Parameters used in the extend
string: string # Name/value pairs.
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
extends
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
extends: # Required. Extends a template
template: string #
parameters: # Parameters used in the extend
string: string # Name/value pairs.
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
Properties
extends
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
extends: # Required. Extends a template
template: string #
parameters: # Parameters used in the extend
string: string # Name/value pairs.
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
extends
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.extends: # Required. Extends a template
template: string #
parameters: # Parameters used in the extend
string: string # Name/value pairs.
pool: pool # Pool where jobs in this pipeline will run unless otherwise specified
name: string # Pipeline run number..
trigger: trigger # Continuous integration triggers
parameters: [ name ]
pr: pr # Pull request triggers
schedules: [ cron ]
resources: # Containers and repositories used in the build
builds: [ build ]
containers: [ container ]
pipelines: [ pipeline ]
repositories: [ repository ]
webhooks: [ webhook ]
packages: [ package ]
variables: variables # Variables for this pipeline
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests. (runLatest,sequential)
Properties
extends
pool
name
string_allowExpressions
Pipeline run number.trigger
parameters
pr
schedules
resources
variables
lockBehavior
string
Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.See also
Feedback
Submit and view feedback for