Symptoms:
When triggering a build via the REST API, the build starts on the default branch of the corresponding VCS root, and the following warning is displayed: The build was triggered in the branch BRANCH_NAME which does not correspond to any branch monitored by the build VCS roots., where BRANCH_NAME is the name of the branch passed via the REST API payload.
Cause:
When triggering a build on a specific branch using the lastChanges model in the API request body, TeamCity does not automatically initiate a check for changes. This means if the specified branch or revision is not yet known to TeamCity, the system will fall back to the default branch and display the warning mentioned above.
Solution:
Use the revisions model instead. With this model, if TeamCity is not aware of the specified branch names or revisions, it will automatically initiate a change collection process and attempt to fetch them from the remote repository.
Another advantage of using revisions is that it allows you to use specific commit hashes for individual VCS roots. This is particularly useful in build configurations that involve multiple VCS roots.
You can find examples of using the revisions model in this article.
Comments
0 comments
Please sign in to leave a comment.