Lets use expressions to print the BuildId and Parameter
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
parameters:
- name: version
displayName: version
type: string
default: v1.0
variables:
runtimetag: ${{format('{0}-{1}', 'v1.0', '$(Build.BuildId)')}}
steps:
- script: "echo ${{ parameters.version }}-$(Build.BuildId)"
displayName: Say hello
- script: "echo ${{ variables.runtimetag }}"
displayName: "Say hello again"
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
variables:
color: red
steps:
- ${{ if eq(variables.color, 'red') }}:
- script: echo red
displayName: red
- ${{ if eq(variables.color, 'blue') }}:
- script: echo blue
displayName: blue
repeating the steps
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
variables:
color: red
parameters:
- name: listofbuilds
type: object
default:
- mac
- windows
- linux
steps:
- ${{ if eq(variables.color, 'red') }}:
- script: echo red
displayName: red
- ${{ if eq(variables.color, 'blue') }}:
- script: echo blue
displayName: blue
- ${{ each value in parameters.listofbuilds }}:
- script: echo ${{ value }}
displayName: ${{ value }}