AzDO 管道:继承扩展模板中的阶段条件

时间:2021-07-13 18:34:02

标签: azure-devops azure-pipelines azure-pipelines-yaml

我有一个接受 stageList 参数并用基本功能包装这些阶段的模板:

parameters:
- name: buildStages
  type: stageList
  default: []
- name: deployStagesNonProd
  type: stageList
  default: []
- name: deployStagesProd
  type: stageList
  default: []

以下是这可能产生的阶段示例:

stages:
- stage: buildStage1
- stage: buildStage2
- stage: deployStageNonProd
- stage: base_preDeploy
- stage: deployStageProdPrimary
- stage: deployStageProdSecondary
- stage: base_postDeploy

我希望base_preDeploy阶段继承其基于第一阶段的阶段条件 在 deployStagesProd 参数的依赖关系图中。我没有看到任何方法可以从 stageList 中完成此操作。

示例:如果在 prod 部署阶段有 eq(variables['Build.SourceBranch'], 'refs/heads/main') 条件,我希望我的 preDeploy 具有相同的条件。

我可以接受一个参数来设置条件,但这似乎很草率。我已经有了阶段和他们的条件,我不应该要求用户提供其中的一个子集。

0 个答案:

没有答案