

So, not very useful at all, except for triggering refresh faster in cases when you have set it to a lower than 60 seconds value in TeamCity (but then you’ll miss merge request open events).Īlso, I’m not sure how to set TeamCity refspecs if I want a particular build configuration to monitor only merge-request branches and ignore master and other branches? It seems, GitLab side with its TeamCity plugin is used only for Push events and not for Open merge request events – we would need a full support for GitLab webhooks in TeamCity to support all other kinds of GitLab events.

Choose VCS Root as All attached VCS Roots, choose Publisher as GitLab and fill in required GitLab information (you have to use an account with Developer permission in the GitLab project).Edit Build Configuration > Build Features, add Commit status publisher.

Enable Commit status publisher build feature.You don’t need to add any trigger in TeamCity, GitLab will automatically trigger a build for each push.Edit VCS Root, make sure Branch specification include +:refs/heads/(*) and +:/refs/(merge-requests/*)/head (don’t set it to +:*, which makes TeamCity confused about the branch name sent from GitLab).Fill in TeamCity URL (server URL), Build type (build configuration ID), username and password.Luckily, most the integration is already built-in, although not all works as expected. You can continue below to get more details on the steps. Enable “Commit status publisher” build feature.

Enable TeamCity build configuration to monitor and trigger build for all (CI) branches.Enable TeamCity integration in your GitLab project settings.Tldr, you need to go through 3 main steps: Ability to enforce a successful build before any MR can be merged.Bigger tick for each merge request (MR) showing that a build has run successfully on the head of the merge request.Small green tick for each commit showing that a build has run successfully on the commit.I note down the step I did to integrate TeamCity build server and GitLab CI pipeline.
