Search code examples
teamcitygitolite

Making gitolite trigger teamcity builds


Rather than having teamcity log onto the gitolite server several tens of thousands of times each day - and also sitting around waiting for the poll to happen (or starting it manually).

It would be nice if it was possible to set it up gitolite hooks that inform TeamCity that the repository has changed.

Is such a configuration possible with TeamCity and gitolite?

I know Jenkins has a github plugin that works nicely - I use that setup for some Minecraft CI I am running privately.


Solution

  • One way would be to gitolite (through a VREF hook) to call TeamCity through its REST API, in order to launch a build through web request.

    You just need to make web request to the following URL:

    http://YOURSERVER/httpAuth/action.html?add2Queue=btId
    

    , where btId is build type Id – unique identifier for each build configuration.
    To get it, you can just look for it in browser address bar, when clicking on build configuration, or use TeamCity REST API for details.


    The OP Morten Nilsen didn't need a VREF:

    • add a file "post-receive" to .gitolite/hooks/common and
    • run gitolite setup --hooks-only