Pipelines

Concepts

  • Triggers cause Pipelines to Run.
  • Pipelines define a set of one or more Stages, and can deploy to one or more Environments.
  • Stages organise Jobs.
  • Jobs run on Agents.
    • Except for agentless jobs, which run directly on the platform.
  • Steps are the smallest components of a pipeline and represent individual actions the pipeline performs.
    • Tasks are pre-packaged scripts that perform actions.
    • Scripts can perform shell actions.
  • Resources are reusable components used by Pipelines that may be defined independently (stages, jobs, and steps).
  • Environments group Resources
  • Artifacts may be published by Runs.
  • Agents execute build jobs.
  • Pools group related build agents.
  • Deployment Groups group related deployment targets into environments.
  • Service Connections store credentials for remote services, and can be secured to users, groups, projects and pipelines.
  • Variables are either system- or user-defined values that can be substituted into pipelines.
    • Variable groups group variables, facilitating reuse.
  • Parameters

Examples

Multiple repositories

The repository containing the pipeline definition is always cloned to $(Agent.BuildDirectory)/s. Additional repositories may be added as follows:

resources:
  repositories:
    - repository: identifier  # identifier for the repo used for operations like checkout
      type: github            # bitbucket, git, github
      name: LukeCarrier/azdo  # or clone URL
      endpoint: LukeCarrier   # the service connection to clone over
      ref: main               # defaults to the default branch; may be specified in checkout

Note that the repository will need to be checked out:

steps:
  - checkout: identifier

Templates

Templates include a section of a pipeline from another file. For instance:

parameters:
  - name: name

steps:
  - script: echo "Hello, ${{ parameters.name }}"

May be sourced in a pipeline as follows:

steps:
  - template: steps/greet.yaml@identifier
    parameters:
      name: Luke

Note that it's not currently possible to import parameters from a template: they must be duplicated.

References