我有一个管道,它有一个像这样的部分,列出将触发管道的管道。
resources:
# List all the microservice pipelines to be watched plus infrastructure, the pipeline name is the name
# of the stack. Note template-maven and template-gradle are not to be part of this build.
pipelines:
- pipeline: auth
project: services
source: auth
branch: master
trigger:
branches:
include:
- master
- pipeline: ai
project: services
source: artificial-intelligence
branch: master
trigger:
branches:
include:
- master
- pipeline: ui
project: frontend
source: ui CI
branch: master
trigger:
branches:
include:
- master然后,我就有了一个包含以下步骤的作业(因为deployment提取了所有文件,所以我只需要从每个管道中提取一个文件夹)
- job: publishDeploymentPipelineFiles
condition: not(canceled())
steps:
- checkout: none
- download: auth
artifact: drop
- download: ai
artifact: drop
- download: ui
artifact: drop我希望的是某种形式的模板
steps:
- checkout: none
- template: pull-deployment-manifests.yml
parameters:
sources:
- project: services
source: auth
stackName: auth
- project: services
source: artificial-intelligence
stackName: ai
- project: frontend
source: ui CI
stackName: ui它只列出项目和CI管道,并从stackName创建适当的管道ID,并创建资源和步骤。
我现在的解决办法是创建一个项目,该项目接受包含这些项的CSV并生成azure-管道.CSV
发布于 2021-05-26 02:24:37
据我所知,您无法动态创建资源。所以你创造了这个
steps:
- checkout: none
- template: pull-deployment-manifests.yml
parameters:
sources:
- project: services
source: auth
stackName: auth
- project: services
source: artificial-intelligence
stackName: ai
- project: frontend
source: ui CI
stackName: ui并在模板中运行签出,除非在根级别上使用这些名称定义资源。
如文档所述,这里
资源是在一个地方定义的,可以在管道中的任何地方使用。
发布于 2021-05-26 02:24:41
确保可以使用资源设置模板,并在YAML管道中使用此模板。您可以引用"从具有资源的模板扩展“。
但是,请注意,如果在模板中定义了资源和步骤,则不能在YAML管道中的steps键下使用它。您应该使用extends键从模板扩展资源,如文档中的示例所示。
您可能需要在模板中定义所有必需的步骤,或者使用从其他step template到模板的步骤。
https://stackoverflow.com/questions/67691362
复制相似问题