Is there any way to specify branch when invoke an build request through teamcity rest api ?
How can specify branch when invoke an build request through teamcity rest api ? The "branch" I mean is not the logical branch name, it's the branch where teamcity checkout code.
Please sign in to leave a comment.
Hi,
By passing the "branchName" property on the build set to the branch you want to build teamcity should check out that branch when downloading the code. Are you having issues with that?
Hi, Denis
Thanks for your reply! I think I should also set Branch specification(teamcity:branchSpec) to +:refs/heads/* in VCS Root Edit panel at first, so that teamcity can recognize the branchName I pass to it. If I don't set Branch specification firstly, according to my experience, teamcity will always check out the default branch when downloading the code because it doesn't track branch information. Am I right?
Hi,
You are absolutely right. The VCS Root needs to have information on that branch, or the build won't trigger. Sorry I didn't mention that, it's a requirement for supporting branches, so I didn't consider it related to the issue by that description.
If no branch specification is provided, teamcity only tracks the default branch, meaning it will just trigger builds on it, as no other branch is available for TeamCity to use.
Denis
Clear explanation! Really appreciate for your help.