CI如何推送到位于另一个租户下方的另一个存储库

时间:2020-05-27 04:38:53

标签: git yaml devops

如何通过CI推送到另一个租户下面的另一个存储库? 我们必须向客户发布代码。他们还使用Azure devops。 CI可以做到吗?

1 个答案:

答案 0 :(得分:0)

我使用“ Git mirror”解决了我的问题。我用了PAT。

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
  vmImage: 'ubuntu-latest'
steps:
- script: |
     cd /tmp && rm -rf /tmp/$(TmpRepoDir)
     git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" clone --mirror $(Build.Repository.Uri) $(TmpRepoDir)
     git -C /tmp/$(TmpRepoDir) push --mirror https://{anything}:{PTA}/{organization}/{project name}/_git/{repository name}
  displayName: 'Copy to GitLab'