问题描述
我在天蓝色DevOps上的TFS服务器上有我的代码仓库。在此应用程序的CI部分中,我执行一些操作,并在生成一个文件之后,说它是从存储库中现有版本创建的某种日志文件或报告,但现在我想签回到我的代码中从构建管道回购。 那么什么是最好的解决方案?
解决方法
如果使用TFVC版本控制,则可以在管道的命令行任务中调用Powershell任务中的REST API Changesets - Create或在命令行任务中调用TF Command Checkin command,以创建新的变更集。
POST https://dev.azure.com/{organization}/{project}/_apis/tfvc/changesets?api-version=5.0
tf checkin [/author:author name] [/comment:("comment"|@comment file)]
[/noprompt] [/notes:("Note Name"="note text"|@notefile)]
[/override:(reason|@reasonfile)] [/recursive] [/saved] [/validate] [itemspec] [/bypass] [/force] [/noautoresolve] [/login:username,[password]] [/new]
如果您使用Git版本控制,则可以调用REST API Pushes - Create将更改推送到存储库。
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pushes?api-version=5.0