我有一组看起来像这样的工作阶段。
- stage: UpdateWoW
dependsOn: Install
variables:
- group: ${{ parameters.StageVars }}
jobs:
- template: UpdateApp.yml
parameters:
AppName: WoW
Project: oxygen
- stage: UpdateSCII
dependsOn: Install
variables:
- group: ${{ parameters.StageVars }}
jobs:
- template: UpdateApp.yml
parameters:
AppName: SCII
Project: carbon
- stage: UpdateDIII
dependsOn: Install
variables:
- group: ${{ parameters.StageVars }}
jobs:
- template: UpdateApp.yml
parameters:
AppName: DIII
Project: xenon
在这里,我只是使用两个不同的参数来调用同一模板。我想用一个矩阵来清理它。所涉及的示例在涉及模板时并没有给我带来太多帮助。我已经尝试了一些变体,但是到目前为止,无论我在何处注入矩阵或包含策略都是“意外”。
- stage: UpdateApps
dependsOn: Install
variables:
- group: ${{ parameters.StageVars }}
jobs:
- template: UpdateApp.yml
matrix:
wow:
AppName: WoW
Project: oxygen
sc2:
AppName: SCII
Project: carbon
d3:
AppName: DIII
Project: xenon
parameters:
AppName: $(AppName)
Project: $(Project)
被调用的模板如下:
#UpdateApp.yml
parameters:
AppName: $(AppName)
Project: $(Project)
jobs:
- job:
timeoutInMinutes: 120
variables:
Path: D:\games
steps:
- template: prep.yml $(Path)
- script: dostuff.cmd $(Path) ${{parameters.AppName}} ${{parameters.Project}}
- script: domore.cmd $(Path) ${{parameters.AppName}} ${{parameters.Project}}
答案 0 :(得分:0)
弄清楚了。 Matrix进入工作级别。阶段如下:
- stage: UpdateApps
dependsOn: Install
variables:
- group: ${{ parameters.StageVars }}
jobs:
- template: UpdateApp.yml
模板:
#UpdateApp.yml
jobs:
- job:
timeoutInMinutes: 120
variables:
Path: D:\games
strategy:
matrix:
wow:
AppName: WoW
Project: oxygen
sc2:
AppName: SCII
Project: carbon
d3:
AppName: DIII
Project: xenon
steps:
- template: prep.yml $(Path)
- script: dostuff.cmd $(Path) $(AppName) $(Project)
- script: domore.cmd $(Path) $(AppName) $(Project)