Mukeem Ahmed
Mukeem Ahmed

Reputation: 123

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?

Upvotes: 0

Views: 1372

Answers (1)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31075

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

Upvotes: 1

Related Questions