Have you ever wanted to integrate your Github repository with your MantisBT so that your git commit messages update the bug(s) they relate to? This article will describe this feature and how to enable it on your devZing account.
Some of the features are:
- The ability to link changesets to issues and the users that created them
- Automatic resolving or manipulation of issues depending on commit messages
- The ability to intelligently map repository branches to project versions in the tracker
For instance, when I commit a bugfix to my repository’s “master” branch, if the commit message says “Fixes issue #17”, the tracker can automatically mark issue #17’s fixed in version “1.3.x”, the current development version.
Once the repository and commit data has been imported into MantisBT, it can be browsed or searched, and each changeset is automatically link the committing user.
There are 3 steps to enabling this functionality
- Install the Plugin
- Configure the repository
- Import the repository
Install the Plugin
Log into your MantisBT with a user that has administrator access level.
Navigate to Manage then Manage Plugins.
Scroll down until you see the Source Control Integration plugin
- Click Install
Scroll down again until you see GitHub Integration
- Click Install
You have now installed all the plugins required.
Configure the Repository
You need to tell MantisBT what repository you want to use for the integration. You can get a list of repositories by logging into your Github account
Click “Repositories” on the main menu.
- Fill in the “Create Repository” form
Name – required (Can be anything, but should related to the Github repository)
Type – choose Github
- Click “Create Repository”
You’ll be taken to a second form with a new set of options based on the repository type chosen. Fill in the form
- Name- should already be filled in
- URL- the GitHub repository’s URL
- Github Username – the GitHub username of the repository’s owner in the GitHub Username field
- GitHub Repository Name -the GitHub repository’s name in the GitHub Repository Name field
- If it’s a public GitHub repository, you can skip the GitHub Application Client ID & GitHub Application Secret fields. If it’s a private repository, you’ll need to configure a GitHub Developer Application:
- Visit https://github.com/settings/developers and click the Register new application button.
- Enter MantisBT Source Integration in the Application name field.
- Enter the URL for your Mantis installation in the Homepage URL field (i.e. https://app.devzing.com/myaccount/mantisbt/).
- Enter the URL for your Mantis Source/oauth page e.g. https://app.devzing.com/myaccount/mantisbt/plugin.php?page=Source/oauth).
- Click the Register application button.
- Switch back to your Mantis GitHub Repository configuration.
- Enter your GitHub Developer Application’s Client ID in the GitHub Application Client ID field.
- Enter your GitHub Developer Application’s Secret in the GitHub Application Access Secret field.
- You can specify a branch or branches other than just “master” in the Primary Branches field, if you like.
- Click “Update Repository”
Import the Repository
The last step is to bring in all the data from the Subversion repository. If the repository is new or doesn’t have many commits this process is quick. For a larger existing repository this could take many minutes and you may have to run this process more than once to get it all.
- To begin with the repository import process, click “Import Latest Data” button
- A window to confirm importing process will appear, click on “Import Latest Data”
You will see a message showing you the import results when complete.
From now on devZing will automatically add new changesets to your MantisBT every time you commit to the configured Subversion repository.
Commit Messages
In addition to the changesets showing up in MantisBT you can add information to your commit message to automatically resolve the bugs related to the commit.
Just include “fixed #101” in the commit message and issue 101 will be marked as fixed and resolved. You can include multiple issues separated by commas – “Fixed #101,#123”