在循环 YAML 模板化的 azure devOps 管道之后执行任务
doing a task after a looping YAML template-ized azure devOps pipeline
我有一个 YAML Azure DevOps 管道循环遍历一系列配置,将工件复制到各个地方。我想做的是,在循环完成后,做一些其他事情(我想发送一封电子邮件,但问题比这更笼统)。
但我不能在 YAML 的循环部分之后插入任何内容,至少在我尝试过的任何实验中都不能。这是调用 YAML 模板的 YAML,并附有关于我想在何处执行其他步骤的注释。我该怎么做?
parameters:
- name: configuration
type: object
default:
- Texas
- Japan
- Russia
- Spaghetti
- Philosophy
trigger:
- dev
- master
resources:
repositories:
- repository: templates
name: BuildTemplates
type: git
stages:
- ${{ each configuration in parameters.configuration }}:
- template: build.yml@templates
parameters:
configuration: ${{ configuration }}
appName: all
# Where I'd like to have another task or job or step or stage that can send an email or perhaps other things
只需定义一个新阶段:
stages:
- ${{ each configuration in parameters.configuration }}:
- template: build.yml@templates
parameters:
configuration: ${{ configuration }}
appName: all
- stage: secondStage
jobs:
- job: jobOne
steps:
- task: PowerShell@2
我有一个 YAML Azure DevOps 管道循环遍历一系列配置,将工件复制到各个地方。我想做的是,在循环完成后,做一些其他事情(我想发送一封电子邮件,但问题比这更笼统)。
但我不能在 YAML 的循环部分之后插入任何内容,至少在我尝试过的任何实验中都不能。这是调用 YAML 模板的 YAML,并附有关于我想在何处执行其他步骤的注释。我该怎么做?
parameters:
- name: configuration
type: object
default:
- Texas
- Japan
- Russia
- Spaghetti
- Philosophy
trigger:
- dev
- master
resources:
repositories:
- repository: templates
name: BuildTemplates
type: git
stages:
- ${{ each configuration in parameters.configuration }}:
- template: build.yml@templates
parameters:
configuration: ${{ configuration }}
appName: all
# Where I'd like to have another task or job or step or stage that can send an email or perhaps other things
只需定义一个新阶段:
stages:
- ${{ each configuration in parameters.configuration }}:
- template: build.yml@templates
parameters:
configuration: ${{ configuration }}
appName: all
- stage: secondStage
jobs:
- job: jobOne
steps:
- task: PowerShell@2