繁体   English   中英

使用构建/发布管道任务将更改从 AzureDevOps git 存储库上传到私有 TFS 服务器

[英]Upload changes from AzureDevOps git repo to private TFS server using Build/Release pipeline task

我有一个托管在 dev.azure.com(AzureDevops) 上的 GIT 存储库,以及托管在私有服务器上的本地 TFVC 存储库(我无法访问机器,我只能访问其 ZC6E190B284633C48EZ 门户)。 两者都有相同的代码。

我在 AzureDevops 中为我的 GIT 存储库创建了一个构建和发布管道,运行良好。 但是现在,我想从 GIT 存储库更新我的 TFVC 存储库,作为每次在 AzureDevops 中执行管道时的构建/发布管道任务。

没有任何可能发生冲突,因为没有其他人会将更改签入到我的 TFVC 存储库。

有什么办法可以做到这一点?

What I would do is add a remote to your Azure DevOps service repo that points to you internal TFS (as long as you internal TFS is visible from the internet) then in your build (in the service) you can just call git push internalorigin. Now if you can't see you internal TFS from the web then like Cece mentionned, install a build agent on your TFS server and in the build create an agent step and then call an inline powershell to add a remote and then call git push internalorigin像这样的东西

多代理构建

然后在脚本中你可以做这样的事情

git remote add internalorigin https://TFSSERVER/COLLECTION/_git/REPO
git push -u internalorigin --all

更新:

从 Git 到 TFVC,您的内联脚本会将本地文件从构建复制到本地 TFVC 工作区,然后使用 TF.exe 签入类似这样的内容

copy c:\agent\_work\1\s c:\workspace /Y
cd c:\workspace
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\Team Foundation\Team Explorer\TF.exe" vc checkin /comment:"comment" /noprompt /recursive *

您必须首先从命令行尝试它,确保它可以工作,然后将其放入内联脚本中。

您可以在 TFS 存储库机器上部署自托管代理 并在 Build/Release 管道中添加脚本任务以更新存储库。

按照 Etienne 所说的去做,但是如果您的目标 repo 是 tfvc,请将命令行任务添加到使用 tf.exe(而不是 git)上传并提交到您的 tfvc repo 的管道中,并管理工作区。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM