# First pipeline
steps:
- bash: echo "The first pipeline runs first"
# Second pipeline
# We are setting up a pipeline resource that references the first pipeline
# pipeline and setting up a pipeline completion trigger so that our second
# pipeline runs when a run of the first pipeline completes
resources:
pipelines:
- pipeline: firstPipeline # Name of the pipeline resource.
source: first-pipeline # The name of the pipeline referenced by this pipeline resource.
project: ProjectName # Required only if the source pipeline is in another project
trigger: true # Run second pipeline when any run of first pipeline completes
steps:
- bash: echo "second pipeline runs after first pipeline completes"
# First pipeline
# As a task in the first pipeline, update any pipeline
# variables that other pipelines will need
- task: AzureCLI@2
displayName: Update variable
inputs:
azureSubscription: azure-sub-arm
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az pipelines variable-group variable update --group-id <<id>> --name <<variable_name>> --value <<new_value>>
1条答案
按热度按时间ve7v8dk21#
要在两个管道之间创建依赖关系,您可以为第二个管道创建一个管道资源触发器,使其在第一个管道完成时自动运行。例如:
有关详细信息,请参见Microsoft documentation。
对于你的第二个问题,从一个管道传递一个变量到下一个管道,我找到的最好的解决方案是引用和更新管道变量组中的变量,参见文档here。
例如: