gpt4 book ai didi

azure-devops - 在我的 Azure DevOps YAML Pipeline 中,如何将一堆阶段转换为作业矩阵?

转载 作者:行者123 更新时间:2023-12-04 04:17:25 27 4
gpt4 key购买 nike

我有一组看起来像这样的工作阶段。

- 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

我只是用两个不同的参数调用同一个模板。我想用矩阵来清理它。当涉及模板时,记录的示例并没有给我太多的帮助。我尝试了一些变体,但到目前为止,无论我在哪里注入(inject)矩阵或包含策略,都是“出乎意料的”。
- 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}}

最佳答案

弄清楚了。矩阵进入工作级别。舞台是这样的:

- 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)

关于azure-devops - 在我的 Azure DevOps YAML Pipeline 中,如何将一堆阶段转换为作业矩阵?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58437351/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com