Azure Pipelines Matrix variables

Viewed 3984

Can somebody explain me how I can access the variable build from this matrix job setup?

parameters:
  # job ---
  ...
  configurations: [Release, Debug]
  ...

jobs:
  - job: nightly
    displayName: Nightly
    strategy:
      matrix:
        ${{ each configuration in parameters.configurations }}:
          ${{ configuration }}:
            build: ${{ configuration }} # !PARAMETER/VARIABLE FOR JOB SET HERE!
            ${{ if ne(configuration, 'Release') }}:
              dependsOn: Release
    pool:
      vmImage: ${{ parameters.image }}
    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
    steps:
      - powershell: Write-Host ${{ parameters.build }}
        displayName: 'Write Configuration: ${{ parameters.build }}'

The jobs powershell task is showing Write Configuration: so the variable is null?

1 Answers

You can access the variable like every regular variable:

$(build)

So in your pipeline:

- powershell: Write-Host $(build)
Related