我有两个存储库:
运行 Azure 管道时的默认设置,我可以在带有管道定义的存储库分支/标记之间进行选择。我想添加一个参数,我可以用它从源项目中选择一个分支。
这在 Azure 中可以通过简单的方式实现吗?我不想要,我不能在 src_project 中保留管道的定义。
在 Jenkins 中,我们使用了一种额外的方法来获取这些分支,使用共享库插件。
答案 0 :(得分:1)
您可以使用 repositories
类型的 resources
来实现:
resources:
repositories:
- repository: string # identifier (A-Z, a-z, 0-9, and underscore)
type: enum # see the following "Type" topic
name: string # repository name (format depends on `type`)
ref: string # ref name to use; defaults to 'refs/heads/master'
endpoint: string # name of the service connection to use (for types that aren't Azure Repos)
trigger: # CI trigger for this repository, no CI trigger if skipped (only works for Azure Repos)
branches:
include: [ string ] # branch names which will trigger a build
exclude: [ string ] # branch names which will not
tags:
include: [ string ] # tag names which will trigger a build
exclude: [ string ] # tag names which will not
paths:
include: [ string ] # file paths which must match to trigger a build
exclude: [ string ] # file paths which will not trigger a build
并使用 checkout
步,例如:
resources:
repositories:
- repository: MyAzureReposGitRepository # In a different organization
endpoint: MyAzureReposGitServiceConnection
type: git
name: OtherProject/MyAzureReposGitRepo
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
- checkout: MyAzureReposGitRepository