Gitlab / Redmine automatic close issue with commit

Lonely Island picture Lonely Island · May 11, 2015 · Viewed 11.7k times · Source

We are using Gitlab (7.10.2) and Redmine (3.0.2).
All issues are managed in Redmine and Gitlab manages all git-repositories.
We set up Gitlab via the UI so far that commits with the message 'Close #234' are clickable and pointing to the corresponding Redmine ticket website.
We now want to achieve that tickets in Redmine are directly linked with Gitlab commits.
If we are using the internal Gitlab issue system and set the commit-message to ‘Close #234’ the ticket 234 is automatic closed and linked with the commit. But with Redmine as issue service system we are not able to automatic close issues with commits or have any information about this in Redmine.
Does anyone knows how we can modify Gitlab and/or Redmine to close Redmine tickets with Gitlab commits?

Answer

mcane picture mcane · Jun 24, 2015

You can use Redmine as an issue tracker with setting the redmine service in Gitlab (In your project -> Services -> Redmine -> fill the URLs, and set active). If this works, when you press "new issue" button in Gitlab, you are redirected to Redmine new issue page. In Gitlab you should have WebHook to inform the Redmine about new push into the repo. This can be set in the settings "In your project -> Settings -> Web hooks" (how, see here).

In Redmine go to Administration -> Settings -> Repositories. Check your referencing keywords. "closes" or "close" should be in the list. Finally in the same tab there is the table at the bottom, where you choose tracker, your fixing keyword (closes, close), set applied status to "Closed", and choose the appropriate amount of % Done (100%).

Similarly you can set other keywords to change status in Redmine tickets.

Use the redmine_gitlab_hook to keep Redmine repo up-to date.