Her*_*des 7 git azure-devops azure-pipelines
我正在创建一个集成管道,该管道应该执行依赖项目的构建管道(作为验证构建)。所有这些项目都托管在 Azure DevOps 中各自的团队项目中。为了调用各自的管道,我想到了使用repository资源。
根据此处和此处的文档,应该可以从不同存储库执行 YAML 模板。这些示例展示了如何使用repositoryGitHub 托管存储库的资源,但不太清楚如何连接到 Azure Repos 上托管的不同团队项目。当托管在同一团队项目中时,可以按照此答案中的描述来完成。
我试过这个:
resources:
repositories:
- repository: MyRepoAlias
type: git
name: MyRepo
ref: 'refs/heads/master'
# Adding/omitting an endpoint doesn't matter
endpoint: 'MyRepo Service Connection'
pool:
vmImage: 'windows-2019'
steps:
# Calling template on the reference repository
- template: '.\Templates\RunBuild.yml@MyRepoAlias'
Run Code Online (Sandbox Code Playgroud)
根据记录,参考存储库存在于同一 AzD 组织内。如果我将“端点”属性添加到端点也没关系。在本例中,我使用基于令牌的身份验证和完全访问 PAT 将其链接到“Azure Repos/Team Foundation Server”类型的服务连接。
问题:
4c7*_*b41 10
管道支持两种类型的存储库:git 和 github。git 是指 Azure Repos Git 存储库。如果您选择 git 作为类型,则名称引用同一项目中的另一个存储库。例如,otherRepo。要引用同一组织内另一个项目中的存储库,请在名称前加上该项目的名称前缀。例如,OtherProject/otherRepo。
所以你需要这样做:
- repository: MyRepoAlias
type: git
name: MyProject\MyRepo
ref: 'refs/heads/master'
Run Code Online (Sandbox Code Playgroud)
您不需要端点,您不需要服务连接(如果它们位于同一 Azure DevOps 组织下)