stages definition
Stages are a collection of related jobs.
stages: [ stage | template ] # Stages are a collection of related jobs.
Definitions that reference this definition: pipeline
List types
Type | Description |
---|---|
stages.stage | A stage is a collection of related jobs. |
stages.template | You can define a set of stages in one file and use it multiple times in other files. |
Remarks
By default, stages run sequentially. Each stage starts only after the preceding stage is complete unless otherwise specified via the dependsOn
property.
Use approval checks to manually control when a stage should run. These checks are commonly used to control deployments to production environments.
Checks are a mechanism available to the resource owner. They control when a stage in a pipeline consumes a resource. As an owner of a resource like an environment, you can define checks that are required before a stage that consumes the resource can start.
Currently, manual approval checks are supported on environments. For more information, see Approvals.
Examples
This example runs three stages, one after another. The middle stage runs two jobs in parallel.
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- script: echo Building!
- stage: Test
jobs:
- job: TestOnWindows
steps:
- script: echo Testing on Windows!
- job: TestOnLinux
steps:
- script: echo Testing on Linux!
- stage: Deploy
jobs:
- job: Deploy
steps:
- script: echo Deploying the code!
This example runs two stages in parallel. For brevity, the jobs and steps are omitted.
stages:
- stage: BuildWin
displayName: Build for Windows
- stage: BuildMac
displayName: Build for Mac
dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it
See also
Learn more about stages, conditions, and variables.