程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Azure DevOps 管道 - 从其他存储库获取分支大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Azure DevOps 管道 - 从其他存储库获取分支?

开发过程中遇到Azure DevOps 管道 - 从其他存储库获取分支的问题如何解决?下面主要结合日常开发的经验,给出你关于Azure DevOps 管道 - 从其他存储库获取分支的解决方法建议,希望对你解决Azure DevOps 管道 - 从其他存储库获取分支有所启发或帮助;

我有两个存储库:

  • devops - 包含管道定义
  • src_project - 包含项目源

运行 Azure 管道时的默认设置,我可以在带有管道定义的存储库分支/标记之间进行选择。我想添加一个参数,我可以用它从源项目中选择一个分支。

这在 Azure 中可以通过简单的方式实现吗?我不想要,我不能在 src_project 中保留管道的定义。

jenkins 中,我们使用了一种额外的方法来获取这些分支,使用共享库插件。

解决方法

您可以使用 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

大佬总结

以上是大佬教程为你收集整理的Azure DevOps 管道 - 从其他存储库获取分支全部内容,希望文章能够帮你解决Azure DevOps 管道 - 从其他存储库获取分支所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。