我正面临一个让我有点困惑的问题,我想找到最好的方法来避免重复我的管道。
在这个GitHub repos中,我有我的yaml文件来构建这个项目,这个yaml的目标是一个文件夹模板,它在这个文件夹模板上运行C#构建和发布。GitHub回购的结构大致如下:
- Folder 1
- Folder 2
- Folder 3
- Azure-Pipelines(build and Publish)
- Azure-pipeline.yaml在管道运行期间,我的yaml的目标是and管道(生成和发布)文件夹并构建项目。这是我的Azure-管道文件
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>我的GitHub的模板和结构不断重复,就像我在每个gitrepo中都有一个Azure管道文件夹一样。我想做的事。就是在我保存build.yaml和publish.yaml的地方进行一次build.yaml回购。并使all成为管道运行时引用此文件夹的其他repos。
我有办法做到这一点吗?
如果我遗漏了任何细节来澄清我的观点,那就问问吧。提前谢谢你
发布于 2021-05-04 02:05:13
我有办法做到这一点吗?
您可以尝试在YAML管道中使用资源。
以下是几个步骤:
Step1:在项目设置->服务连接中创建服务连接。
Step2:您可以尝试使用下面的示例来使用来自另一个Github的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@MyGitHubRepohttps://stackoverflow.com/questions/67361410
复制相似问题