Mantis Plugin

Mantis Plugin


This plugin integrates Mantis Bug Tracker to Hudson. Mantis is a free popular web-based bugtracking system written in PHP scripting language.
This plugin decorates Hudson "Changes" HTML to create links to your Mantis issues, and update issues with private / public notes.
As an example, if you committed a change with the following log message:

fix issue #410

(Log message should contain "issue XXX" (XXX is issue id).
Mantis keys in changelogs are now hyperlinked to the corresponding Mantis issue pages (complete with tooltips),


and Mantis issues are also updated with note as following.


This plugin only supports Mantis 1.1.0 and above.

Configuration

System Configuration

First, you need to go to Hudson's system config screen to tell Hudson where's your Mantis.

  • URL - the root URL of your Mantis installation, eg. http://example.org/mantis/
  • User Name, Password - user name and password of your Mantis installation to update relevant Mantis issues.

Projecct Configuration

In the top section, select the url of your Mantis installation.


In the Post-build Actions section, choose "Updated relevant Mantis issues" (option).

This plugin updates Mantis issues if build is stable or unstable.

Use BASIC_AUTH (Workaround)

If your mantis installation uses BASIC_AUTH as login method, you need to modify mantis sources as following(maybe bug).

  • api/soap/mc_api.php 44L, replace
    api/soap/mc_api.php (Before)
    function mci_check_login( $p_username, $p_password ) {
        if ( mci_is_mantis_offline() ) {
            return false;
        }
    
        # if no user name supplied, then attempt to login as anonymous user

    with

    api/soap/mc_api.php (After)
    function mci_check_login( $p_username, $p_password ) {
        if ( mci_is_mantis_offline() ) {
            return false;
        }
    
        if ( BASIC_AUTH == config_get( 'login_method' ) ) {
            $p_username = $_SERVER['PHP_AUTH_USER'];
            $p_password = $_SERVER['PHP_AUTH_PW'];
        }
    
        # if no user name supplied, then attempt to login as anonymous user
  • core/authentication_api.php replace
    core/authentication_api.php (Before)
    function auth_attempt_script_login( $p_username, $p_password = null ) {
        global $g_script_login_cookie, $g_cache_current_user_id;
    
        $t_user_id = user_get_id_by_name( $p_username );
    
        $t_user = user_get_row( $t_user_id );
    
        # check for disabled account
        if ( OFF == $t_user['enabled'] ) {
            return false;
        }
    
        # validate password if supplied
        if ( null !== $p_password ) {
            if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
                return false;
            }
        }

    with

    core/authentication_api.php (After)
    function auth_attempt_script_login( $p_username, $p_password = null ) {
        global $g_script_login_cookie, $g_cache_current_user_id;
    
        $t_user_id = user_get_id_by_name( $p_username );
        if ( false === $t_user_id ) {
            return false;
        }
    
        $t_user = user_get_row( $t_user_id );
    
        # check for disabled account
        if ( OFF == $t_user['enabled'] ) {
            return false;
        }
    
        # validate password if supplied
        $t_login_method = config_get( 'login_method' );
        if ( null !== $p_password && $t_login_method != BASIC_AUTH) {
            if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
                return false;
            }
        }

Changelog

Version 0.4.3
  • Fixed UnknownFormatConversionException (issue 2116).
  • Improved Japanese translation.
Version 0.4.2
  • Added more logging for debugging.
  • The username and password of Mantis installation is now optional.
Version 0.4.1
Version 0.4
  • Update mantis issue if build status is unstable.
  • Support unsigned server certs.
Version 0.3.1
  • Fix JavaScript error
Version 0.3
  • Support HTTP Basic Authentication(Not Mantis's BASIC_AUTH)
  • Fix small bug
Version 0.2
  • Remove mantisconnect-client-api.jar.
Version 0.1
  • First version

Labels

  Edit Labels
  1. May 08

    Tom Larrow says:

    Thank you very much, this plugin works great\!

    Thank you very much, this plugin works great!

  2. Jun 12

    Travis Bailey says:

    I like to throw the ability to use HTTPS on the heap of features.  Our Mant...

    I like to throw the ability to use HTTPS on the heap of features.  Our Mantis install is remote from our Hudson install and don't like any passwords going unsecure.

    Additionally, is it reasonable to make this plugin update mantis even when unstable a setting or something?  I mean we run unstable right now a lot because we have a few broken tests out of 500+, I hate the idea of losing mantis updates just because someone has a test in a broken state.

    1. Jun 28

      Seiji Sogabe says:

      please use the issue tracker for RFEs and bugs.

      please use the issue tracker for RFEs and bugs.