Azure devops Azure管道配置
我面临着一个让我有点困惑的问题,我想找到避免重复我的管道的最佳方法 在这个GitHub repos中,我有我的yaml文件来构建项目,这个yaml以一个文件夹模板为目标,它在该模板上运行C#build和Publish。GitHub回购协议的结构大致如下:Azure devops Azure管道配置,azure-devops,azure-pipelines,azure-pipelines-release-pipeline,azure-pipelines-yaml,Azure Devops,Azure Pipelines,Azure Pipelines Release Pipeline,Azure Pipelines Yaml,我面临着一个让我有点困惑的问题,我想找到避免重复我的管道的最佳方法 在这个GitHub repos中,我有我的yaml文件来构建项目,这个yaml以一个文件夹模板为目标,它在该模板上运行C#build和Publish。GitHub回购协议的结构大致如下: - Folder 1 - Folder 2 - Folder 3 - Azure-Pipelines(build and Publish) - Azure-pipeline.yaml 在管道运行期间,我的yaml以Àzure管道(构建和发布)
- Folder 1
- Folder 2
- Folder 3
- Azure-Pipelines(build and Publish)
- Azure-pipeline.yaml
在管道运行期间,我的yaml以Àzure管道(构建和发布)文件夹为目标,并构建项目。这是我的Azure-pipeline.yaml文件
stages:
- stage: Build
displayName: 'Build'
jobs:
- template: Azure-Pipelines/build.yaml
parameters:
solution: 'Solution-to-build'
- stage: Publish
displayName: 'Release and Push'
jobs:
- template: Azure-Pipelines/publish.yaml
parameters:
<All the parameters configured for this yaml file>
阶段:
-阶段:建造
displayName:“生成”
工作:
-模板:Azure管道/build.yaml
参数:
解决方案:“构建解决方案”
-阶段:出版
displayName:“释放并推送”
工作:
-模板:Azure Pipelines/publish.yaml
参数:
我的GitHub的模板和结构不断重复,就像在我拥有的每个gitrepo Azure管道文件夹中一样。我想说的是。就是有一个GitHub repo,我保存build.yaml和publish.yaml。并在管道运行时使所有其他回购协议都引用此文件夹
我有什么办法可以做到这一点吗
如果我缺少任何细节来说明我的观点,请尽管问。事先非常感谢
我有什么办法可以做到这一点吗
您可以尝试在YAML管道中使用
以下是步骤:
步骤1:在项目设置->服务连接中创建Github服务连接
步骤2:您可以尝试使用以下示例来使用另一个Github Repo的yaml模板
示例
resources:
repositories:
- repository: MyGitHubRepo # The name used to reference this repository in the checkout step
type: github
endpoint: serviceconnectionname
name: githuborg/reponame #e.g. yy/test
ref: main
pool:
vmImage: ubuntu-latest
stages:
- stage: Build
displayName: 'Build'
jobs:
- template: Azure-Pipelines/build.yml@MyGitHubRepo
嗨,纳登·凡。有关于这个问题的更新吗?请随时告诉我该方法是否能满足您的要求。@KevinLu MSFT非常感谢您的建议和帮助,我将很快对其进行测试。现在,我正在与azure管道进行斗争,该管道无法构建我的docker文件