Steps are the most fundamental building blocks of an Azure DevOps pipeline. Each step represents a single action to be performed during the execution of a job. When you define a pipeline with steps and without explicitly defining jobs, Azure DevOps will create an implicit job to contain those steps.
Step Schema
steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # Required. A list of steps to run in this job.
strategy: strategy # Execution strategy for this job.
continueOnError: string # Continue running even on failure?
pool: string | pool # Pool where jobs in this pipeline will run unless otherwise specified.
container: string | container # 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.
name: string # Pipeline run number.
appendCommitMessageToRunName: boolean # Append the commit message to the build number. The default is true.
trigger: none | trigger | [ string ] # Continuous integration triggers.
parameters: [ parameter ] # Pipeline template parameters.
pr: none | pr | [ string ] # Pull request triggers.
schedules: [ cron ] # Scheduled triggers.
resources: # Containers and repositories used in the build.
builds: [ build ] # List of build resources referenced by the pipeline.
containers: [ container ] # List of container images.
pipelines: [ pipeline ] # List of pipeline resources.
repositories: [ repository ] # List of repository resources.
webhooks: [ webhook ] # List of webhooks.
packages: [ package ] # List of package resources.
variables: variables | [ variable ] # Variables for this pipeline.
lockBehavior: string # Behavior lock requests from this stage should exhibit in relation to other exclusive lock requests.
Step Types
Azure DevOps Pipelines supports several types of steps:
Task
A task is a pre-packaged script that performs a specific action. Azure DevOps provides many built-in tasks, and you can also use tasks from the marketplace.
The checkout step is used to check out source code from a repository.
- checkout: self # self represents the repo where the pipeline is defined
clean: true # whether to fetch clean each time
fetchDepth: 1 # the depth of commits to ask Git to fetch
Download
The download step downloads artifacts from the current or another pipeline run.
- download: current # refers to artifacts published by current pipeline
artifact: WebApp # name of the artifact to download
path: $(Build.ArtifactStagingDirectory)/WebApp # download path
Publish
The publish step publishes (uploads) a file or folder as a pipeline artifact.