你可以尝试使用multi repo checkout
resources:
repositories:
- repository: devops
type: github
name: kmadof/devops-templates
endpoint: kmadof
steps:
- checkout: self
- checkout: devops
- script: |
echo $(Build.SourcesDirectory)
ls $(Build.SourcesDirectory) *
我们在这里签出两个 repo,一个将转到 devops-manual 文件夹(自我 repo,在您的情况下应该是 repoX),另一个将转到 devops-templates 文件夹(在您的情况下是 repo2)。
现在您应该在变量中分配 repo2 的路径。为此,您应该使用日志记录命令:
- powershell: Write-Host "##vso[task.setvariable variable=repoxpath;]$(Build.SourcesDirectory)/devops-templates"
现在我们应该用路径更新build.xml,因此我建议使用Replace Token task
- task: replacetokens@3
inputs:
targetFiles: '<path-t-your-build.xml-file>'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '#{'
tokenSuffix: '}#'
useLegacyPattern: false
enableTelemetry: true
在你想放置路径的地方你应该有这个令牌#{repoxpath}#