Search code examples
teamcity-9.0teamcity-rest-api

Trigger TeamCity build on a specific BitBucket repo branch


I'm trying to trigger a TeamCity build using the REST API on a specific branch in a repository. However, it is always fetching the code from the master branch (which is the default one). Not sure where I am doing it wrong. Is there anything else I need to set up on the TeamCity to turn on this feature?

My curl is:

curl -v -u uname:pwd http://remoteserver.com:8111/httpAuth/app/rest/buildQueue --request POST --header "Content-Type:application/xml" --data-binary @build.xml

And my build.xml is:

<build branchName="testBranch">
<buildType id="TestTc_TestTc"/>
</build>

I'm using TeamCity 9. Could anyone help me on where I am doing it wrong?


Solution

  • I have added "+:refs/heads/(*)" under Branch Specification in the VCS Root settings and it worked fine.