Azure devops 如何获得矩阵';s工作';yaml文件步骤部分中的名称?
我有一个非常简单的Azure管道YAML文件,如:Azure devops 如何获得矩阵';s工作';yaml文件步骤部分中的名称?,azure-devops,azure-pipelines,Azure Devops,Azure Pipelines,我有一个非常简单的Azure管道YAML文件,如: pool: vmImage: 'ubuntu-18.04' strategy: matrix: debian: img: 'debian:latest' fedora: img: 'fedora:latest' arch: img: 'archlinux:latest' opensuse: img: 'opensuse/leap:latest' con
pool:
vmImage: 'ubuntu-18.04'
strategy:
matrix:
debian:
img: 'debian:latest'
fedora:
img: 'fedora:latest'
arch:
img: 'archlinux:latest'
opensuse:
img: 'opensuse/leap:latest'
container: $[ variables['img'] ]
steps:
- script: printenv
displayName: Dump env
- script: make
displayName: Build the project
它只不过是在上面列出的四个容器中的每一个上构建相同的项目
它可以工作,但我还希望有一个步骤使用作业名称(debian、fedora等)来运行特殊脚本
如何在步骤中访问作业名称?是否有类似于$(作业)
的内容?您可以使用变量$(Agent.JobName)
。例如:
steps:
- script: echo $(Agent.JobName))
displayName: echo $(Agent.JobName))
将给出以下输出:
有没有办法不用“作业”就可以实现这一点?@Ethanfisher这是默认设置:/n您可以添加一个小脚本来删除它。