在步骤条件下使用矩阵环境变量的Azure管道

时间:2019-08-08 11:01:26

标签: azure-devops azure-pipelines

在我的Azure DevOps管道中,我具有以下内容:

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

我想在步进条件下使用TYPE,有点像下面的内容,我该怎么做?

- bash: |
    set -ev
    cd ./client
    npm install
  displayName: install
  env:
    DISPLAY: ':99.0'
  condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(${{'TYPE'}}, 'unit'))``

1 个答案:

答案 0 :(得分:1)

矩阵变量就像每个变量一样,因此:

condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['TYPE'], 'unit'))
相关问题