Trigger personal build with pre-commit changes by HTTP request

Is there a way to trigger personal build with pre-commit changes (same as what tcc.jar command line utility does), but via HTTP request? (REST API is preferred, but not necessary)
I understand that, in this case, collecting VCS changes automatically would be impossible.
Let's assume that I have created a patch file, which is normally made by tcc.jar, manually.
What I need to do next is pass this patch to the server, create a change out of it, and specify this change for the new build.
Can it be done by using only HTTP?

Comment actions Permalink

Hi Artem,

Could you please detail why can't you use tcc.jar for the task?

In theory, it should be possible, but at this point this is not a way which we officially support. I described the approach in the comment to a related issue.

Comment actions Permalink

Hi Yegor,

Thank you for your response.
This is exactly what I was looking for.
It works perfectly (at least, for now).

There are several reason why I would like to avoid the usage of tcc.jar.

Main one is the fact that buidl triggering via REST is highly customizable, which is a great thing. It is possible to specify custom parameters, dependencies and agent. tcc.jar can't do any of that.
Second main reason is that I already have the script that uses REST, and changing the utility for one specific scenario is something I very much want to avoid.
Last, but not least, running tcc.jar takes a considerable amount of time and CPU resources. Compared to that, simly sending 2 HTTP requests with curl is lightning fast.

I hope this method will still be supported in the future.

Comment actions Permalink

Just in case, I'd like to post the BASH script that can generate a patch file for POST request.
It may be used as the reference to understand the mechanics.

Comment actions Permalink


Wow, thank you for the script!

It would be interesting to know more about your TeamCity usage related to the scripts, especially if there is something which can be reused by other users of TeamCity.

Comment actions Permalink

This script is really helpful to me since I'm pretty much trying to do the same thing. Unfortunately it's missing a few important features I need (ex: Deleted files, executable files, etc).

I've looked at the source for the command line tool, but unfortunately the patch builder is not part of the source (LowLevelPatchBuilderImpl). I can try writing the patch file out to disk and reverse engineering it that way, but it'd be much easier if there was documentation available describing the format. Can we get that somewhere?


Please sign in to leave a comment.