Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure pipeline using matrix environment variable in step condition

Tags:

In my Azure DevOps pipeline I have the following:

strategy:
  matrix:
    unit_test_linux:
      imageName: 'ubuntu-16.04'
      TYPE: 'unit'
    cucumber:
      imageName: 'ubuntu-16.04'
      TYPE: 'cucumber'

I want to use TYPE in a step condition, a bit like below, how do I do this?

- bash: |
    set -ev
    cd ./client
    npm install
  displayName: install
  env:
    DISPLAY: ':99.0'
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(${{'TYPE'}}, 'unit'))``
like image 976
Caroline Church Avatar asked Aug 08 '19 11:08

Caroline Church


1 Answers

The matrix variable is like every variable, so in this way:

condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['TYPE'], 'unit'))
like image 117
Shayki Abramczyk Avatar answered Sep 28 '22 23:09

Shayki Abramczyk