簡體   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