Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure devops Azure yaml文件中imageRepository中的条件分支名称_Azure Devops_Yaml_Azure Pipelines - Fatal编程技术网

Azure devops Azure yaml文件中imageRepository中的条件分支名称

Azure devops Azure yaml文件中imageRepository中的条件分支名称,azure-devops,yaml,azure-pipelines,Azure Devops,Yaml,Azure Pipelines,在Azure yaml文件中定义管道。我希望imageRepository包含执行管道的分支的名称。比如说, 如果我从branch\u A运行,我希望有imageRepository:branch\u A\u image 如果我从branch\u B运行,我希望有imageRepository:branch\u B\u image yaml中的这个条件语句是什么样子的?我找到了不同的片段,但找不到所有的'Build.SourceBranch' 我的最终目标是为不同的分支提供不同的容器映像。我现在

在Azure yaml文件中定义管道。我希望imageRepository包含执行管道的分支的名称。比如说,

如果我从
branch\u A
运行,我希望有
imageRepository:branch\u A\u image

如果我从
branch\u B
运行,我希望有
imageRepository:branch\u B\u image

yaml中的这个条件语句是什么样子的?我找到了不同的片段,但找不到所有的
'Build.SourceBranch'


我的最终目标是为不同的分支提供不同的容器映像。我现在计划手动触发管道。

可能您正在搜索
Build.SourceBranch
Build.SourceBranchName
。你可以得到更多的细节。看起来是这样的:

imageRegistory:$(Build.SourceBranchName)

因此,正确的图像名称应如下设置:

imageRegistory:$(Build.SourceBranchName)

这太棒了!你知道我能不能把它连接起来?类似于
$(Build.SourceBranchName)\u contaner
是的,您可以。在我这方面效果很好。@user1700890关于这个问题还有什么更新吗?它能解决你的问题吗?如果它解决了您的问题,请接受它。@user1700890当它解决了您的问题时,您不接受它的原因是什么?标记它很简单。