gpt4 book ai didi

azure - 根据触发管道 Azure Devops 中使用的分支指定构建分支

转载 作者:行者123 更新时间:2023-12-03 05:23:43 25 4
gpt4 key购买 nike

假设我有两个管道:PL1 和 PL2,并且 PL2 由 PL1 触发。假设我在 master 分支上运行 PL1,我希望 PL2 也能被 master 分支触发。当 PL1 在另一个分支(如releases/X.X.X)上触发时,我希望 PL2 也在releases/X.X.X 分支上触发。我可以这样做吗?现在PL2在触发时总是使用master

最佳答案

我尝试复制这个场景。

第一条管道:

trigger:
- none

stages:
- stage: first
jobs:
- job: firstJob
continueOnError: false
steps:
- bash: echo "first from test branch"

第二条管道:

resources:
pipelines:
- pipeline: firstPipeline
source: first-pipeline
trigger:
branches:
include:
- ${Build.SourceBranch}

stages:
- stage: second
jobs:
- job: secondJob
steps:
- bash: echo Test-branch

我从两个不同的分支测试了这些,每次都根据第一个管道的分支获取第二个管道的源代码。

PS:我的两个管道 YAML 都在同一个存储库中

关于azure - 根据触发管道 Azure Devops 中使用的分支指定构建分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70425019/

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