Simplest Enterprise Continuous Integration Solutions

Saturday, February 11, 2012

JIRA migration: BugZilla multi-line desc/comments

BugZilla MySQL database

The longtext table contains each bug_id's associated multi-line desc and multi-line comments.


MySQL query to get bug_id and the text result

SELECT 

    bug_id
    , thetext
FROM
    bugs.longdescs as T1
where
    T1.bug_id in (SELECT 
           bug_id
        FROM
            bugs.bugs
        where
            product_id in (SELECT 
                    id
                FROM
                    bugs.products
                where
                    (name like 'MY_BUGZILLA_PROJECT')))
Order by T1.bug_id
For each of bug_ids associated multi-line thetext entries: 
First entry is the bug_id associated desc
Remaining entries (if existed) are the bug_id associated comments.


Migrate BugZilla multi-line desc & comments into JIRA

1. create a BugZilla query for JIRA migration without multi-line desc/comments
2. JIRA, Administration -> System -> Import & Export -> Import External projects -> CSV Import
3. create a MySQL query to only contains bug ids, and save the query result as XML format

SELECT 
    bug_id
FROM
    bugs.bugs
where
    product_id in (SELECT 
            id
        FROM
            bugs.products
        where
            (name like ' MY_BUGZILLA_PROJECT ')))
Order by bug_id
4. run a PERL script (i.e. xmlBugIdExportIntoJIRA.pl) through JIRA cli interface updating desc/comments on Linux platform from where BugZilla's desc/comments UTF-8 code issue will be solved)

NAME

    xmlBugIdExportIntoJira.pl

SYNOPSIS

  DESCRIPTION

    This script is going to migrate exported XML format from BugZilla MySQL with bug_id, thetext file into Jira.

  VERSION

    Version 1.0

  USAGE

       perl xmlBugIdExportIntoJira.pl --jira_project_key "[jira_project_key]" --jira_field_for_bug_id "[jira_field_for_bug_id]" --jira_field_for_bugzilla_thetext "[jira_field_for_bugzilla_thetext]" --exported_xml_format_bugzilla_mysql_id_description_file "[exported_xml_format_bugzilla_mysql_id_description_file]" --jira_cli "[jira_cli]"
    *   --jira_project_key "[jira_project_key]" - Jira Project Key. *Required*
    *   --jira_field_for_bug_id "[jira_field_for_bug_id]" - Jira field maps to bug_id field. *Required*
    *   --jira_field_for_bugzilla_thetext="[jira_field_for_bugzilla_thetext]" - Jira field maps to bug_id Description field. *Required*
    *   --exported_xml_format_bugzilla_mysql_id_description_file "[exported_xml_format_bugzilla_mysql_id_description_file]" - Fullpath of exported xml format BugZilla MySQL bug_id file. *Required*
    *   execute MySQL query SELECT bug_id FROM bugs.bugs where product_id=(SELECT id FROM bugs.products where name = "MY_BUGZILLA_PROJECT" and save the results into xml
        SELECT bug_id, thetext FROM bugs.longdescs as T1 where T1.bug_id = id Order By bug_when
    *   --jira_cli "[jira_cli]" - Full path of atlassian-cli. *Required*

  EXAMPLE

       1. Migrate exported XML format BugZilla bug_id, thetext file into Jira.
       perl /tmp/xmlBugIdExportIntoJira.pl --jira_project_key "MY_JIRA_PROJECT_KEY" --jira_field_for_bug_id "bug_id" --jira_field_for_bugzilla_thetext "description" --exported_xml_format_bugzilla_mysql_id_description_file /tmp/BugZilla_MySQL_id_longdescs.xml --jira_cli /opt/atlassian-cli-2.4.0/jira.sh

No comments:

Post a Comment