简体   繁体   中英

How to create a change set from build pipeline in Azure DevOps to push some file into my repository

I have my code repo on TFS server on azure DevOps. In my CI part of this application, I perform some operation, and after that one file is generated let say it is some kind of log file or report created from its existing version in the repository but now I want to check in back into my code repo from build pipeline. So what could be the best solution for it?

If you use TFVC version control, you could invoke REST API Changesets - Create in a powershell task or TF Command Checkin command in a command line task in your Pipeline to create a new changeset.

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]

If you Git version control, you could invoke REST API Pushes - Create to push changes to the repository.

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pushes?api-version=5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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