.yaml
file).yaml
same pipeline for both«««< Updated upstream
E.g.:
pool:
vmImage: 'ubuntu-16.04'
container: ubuntu:16.04
steps:
- script: printenv
ENTRYPOINT
USER
has access to groupadd
and other privileges commands without sudo
pool:
vmImage: 'windows-2019'
container: mcr.microsoft.com/windows/servercore:ltsc2019
steps:
- script: set
E.g.:
resources:
containers:
- container: my_container
image: ubuntu:16.04
- container: nginx
image: nginx
- container: redis
image: redis
pool:
vmImage: 'ubuntu-16.04'
container: my_container
services:
nginx: nginx
redis: redis
steps:
- script: |
apt install -y curl
curl nginx
apt install redis-tools
redis-cli -h redis ping
nginx
and redis
containers from Docker Hub and then starts the containersservices
name.apt
, curl
and redis-cli
commands inside the ubuntu:16.04
container.nginx
and redis
host names resolve to the correct services using Docker networking=======
Stashed changes
Variables
System.HostType
, Build.ArtifactStagingDirectory
, Agent.HomeDirectory
.Usage
variables:
configuration: debug
steps:
- task: MSBuild@1 # Use them once
inputs:
configuration: $(configuration) # Use the variable
- task: MSBuild@1 # Use them again
inputs:
configuration: $(configuration) # Use the variable
Usage:
variables:
- group: my-variable-group
steps:
- script: echo $(myhello) # uses macro syntax
- script: echo $[variables.myhello] # uses runtime expression
.yaml
file but ❗ can override YAML continuous integration trigger in pipeline settings.In yaml
:
trigger:
batch: false
E.g.:
trigger:
branches:
include:
- master
- release/*
paths:
exclude:
- /Code/Previous
tags:
include:
- '*'
Schema:
name: string # build numbering format
resources:
pipelines: [ pipelineResource ]
containers: [ containerResource ]
repositories: [ repositoryResource ]
variables: # several syntaxes, see specific section
trigger: trigger
pr: pr
stages: [ stage | templateReference ]
jobs: [ job | templateReference]
steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
Example:
name: $(Date:yyyyMMdd)$(Rev:.r)
variables:
var1: value1
jobs:
- job: One
steps:
- script: echo First step!
checkStyleRunAnalysis: true, pmdRunAnalysis: true, findBugsRunAnalysis: true
E.g. following runs for each resource in the environment:
- stage: deploy
jobs:
- deployment: DeployWeb
displayName: deploy Web App
pool:
vmImage: 'Ubuntu-latest'
# creates an environment if it doesn't exist
environment: 'smarthotel-dev'
strategy:
runOnce:
deploy:
steps:
- script: echo Hello world