I'm using GitLab 8.3.2 and TeamCity 9.1.6. I've set up the JetBrains TeamCity CI service and it is triggering builds in TeamCity when changes are pushed to GitLab.
I'd like it to also trigger a build when a merge request is created (my understanding is that this build could guarantee that hitting the merge button will not break things).
I've got the branch specification in TeamCity set to:
+:refs/heads/*
+:refs/(merge-requests/*)
I can see the merge requests in TeamCity, but they don't actually build.
The merge request in GitLab says 'CI build pending for xxxx'. The view details link does not contain a build number though. I suspect this is because it searches TeamCity to find a matching build and doesn't find it because it wasn't triggered in the 1st place.
I do not have any build triggers configured in TeamCity. (I did originally have a VCS trigger, but I turned it off once I realised that GitLab was triggering builds for me.)
How can I set things up so that a merge request triggers a build in TeamCity and have GitLab display the result of the build in the merge request.
You should decide how you want the builds to be triggered: by TeamCity which will poll GitLab for updates or by GitLab.
For TeamCity way you will need to add a VCS trigger into the build configuration. This will make TeamCity trigger builds on the branches configured in "branch specification". You can also limit the branches to trigger builds for in the trigger settings. You will need to disable GitLab triggering builds in TeamCity.
For GitLab way to trigger builds in all branches you might need to set branch specification to
to make sure the branches are full named (I am guessing here).