Azure devops 带有模板的azure devops yaml管道未签出引用的存储库
我正在使用新的Azure DevOps Yaml多级管道功能 我有一个Azure DevOps yaml管道文件,我想使用模板。我希望管道能够签出self和另一个存储库 由于某些原因,selfrepo在运行时已签出,但repo:pipeline未签出,因此作业失败(因为它所需的某些文件依赖项不存在) 以下是我的模板摘录:Azure devops 带有模板的azure devops yaml管道未签出引用的存储库,azure-devops,azure-pipelines,Azure Devops,Azure Pipelines,我正在使用新的Azure DevOps Yaml多级管道功能 我有一个Azure DevOps yaml管道文件,我想使用模板。我希望管道能够签出self和另一个存储库 由于某些原因,selfrepo在运行时已签出,但repo:pipeline未签出,因此作业失败(因为它所需的某些文件依赖项不存在) 以下是我的模板摘录: 资源: 存储库: -存储库:self -存储库:管道 名称:vstsproject/pipelines 类型:git 资料来源:管道 变量: #在管道创建期间建立的容器注册表服
资源:
存储库:
-存储库:self
-存储库:管道
名称:vstsproject/pipelines
类型:git
资料来源:管道
变量:
#在管道创建期间建立的容器注册表服务连接
imageRepository:“vstsprojectweb”
dockerfilePath:“$(Build.SourcesDirectory)/src/Dockerfile.CI”
BuildConfiguration:“发布”
标记:“$(Build.BuildId)”
阶段:
-阶段:"珠三角"
工作:
-模板:更新连接字符串数据库。yml@pipelines
参数:
resourceGroup:“应用程序开发人员”
DBSearchString:“####dbservername###”
我做错了什么
我已经提到了这一点。我最终把所有东西都放在同一份回购协议中,然后在一份工作中签出了自己 这对我很管用
jobs:
- job: dbconnectionstring
displayName: 'db connection string'
pool: Windows
steps:
- checkout: self
- template: templates/update-connection-string-db.yml
您不需要在资源(即self)中引用链接的repo,如果它是唯一的repo,则默认情况下会在作业(不是部署作业)中签出它,但如果您有其他repo,则需要手动签出它们(使用-checkout:) 那么就这么做吧(PS:稍微清理一下,假设回购在同一个项目中):
同意。我后来发现了,这对我很有用。谢谢
resources:
repositories:
- repository: pipelines
source: pipelines
variables:
# Container registry service connection established during pipeline creation
imageRepository: 'vstsprojectweb'
dockerfilePath: '$(Build.SourcesDirectory)/src/Dockerfile.CI'
BuildConfiguration: 'Release'
tag: '$(Build.BuildId)'
stages:
- stage: 'PRD'
jobs:
- checkout: self
- checkout: pipelines
- template: update-connection-string-db.yml@pipelines
parameters:
resourceGroup: 'application-DEV'
DBSearchString: '###dbservername###'