This simple script exports all bugzilla issues to one csv file. Jira got specific way to import csv files, so here is a script who can help you!
- First of all make sure you got python 3 installed.
- Download this repository to your local machine:
git clone https://github.com/Kalvisan/bugzilla2jira.git bz2jira
next go to foldercd bz2jira
- Install all needed python library
pip3 install -r requirements.txt
- Attention: I created this script while Bugsy wasn't released 0.11.1+ version to public in pip, so I installed newest version by
pip3 install git+https://github.com/AutomatedTester/Bugsy.git
- Attention: I created this script while Bugsy wasn't released 0.11.1+ version to public in pip, so I installed newest version by
- Now you can start editing config file as you need.
open local config example file
more info how to edit file below - You are ready now to start exporting data from bugzilla to local csv file
- Basic export example:
python3 bz2csv.py -c config
a bit more advanced commands you can see below. - Now you got your csv export. You can navigate to jira "External System Import" category and start importing CSV file. You can use example configuration file
jira_configuration_example.txt
for help in mapping fields.
First of all, fill your administrator user and password rows. Next change bugzilla url.
And next and most important
row is "max_comment" and "max_attachment", because the way how jira handle csv file is bit odd.
More info about how jira handle csv files here.
This script require to know, what is the largest count of comments and attachments in ONE issue. If you don't know, just set big numbers like max_comment: 100
and max_attachment: 50
, this will take more time to create csv file and more time to import data to Jira.
If you want to be specific with your config, then my script will count what is the biggest count of attachments and comments in one issue, but script will show you that number only, at the end of process. So you can leave those number as it is and start example run (From "How to start" #6), and in the end you will see numbers.
Inside example config file, there is format:
this is for handling time format for Jira. You need to look up in what way your jira use time format.
You need to convert time to python datetime format, but don't forget to add extra %
before every % symbol, like in the example (python config will not handle single % symbol).
There is two ways how jira handle attachments inside csv file:
- If you leave
advanced_attachment: False
then script will fill attachment with only a link - If you set
advanced_attachment: True
then script will add extra parameters to your attachment like "Create time;Author;Filename;URL"
key:
- your Jira project KEY
def_type:
- what will be your jira issue type
def_user
- what will be default user if none found
There is couple of extra options you can use:
- You can map your bugzilla users. Just give script another argument like
-u user-mapping.cfg
or--user-file user-mapping.cfg
:
By default your bugzilla username will be handled as email first part.i.e. by default: bugzilla_user@example.com
script will use only the part before @
= bugzille_user.
But you can create user mapping file. Script will be reading every single line and split it using =
symbol.
You can map users like this:
jira_user=bugzilla_user@example.com
or
jira_user@example.com=bugzilla_user@example.com
or
jira_user=bugzilla_user
- You can map your status in bugzilla with argument
-s status-mapping.cfg
or--status-file status-mapping.cfg
. File parsing will be the same as user file parsing.
- In older versions of bugzilla, you can't login using header values, so jou need to pass params instead of headers. (This issue is more bugsy problem)
- Add external field mapping, from file, or other place
- Add "Duplicate" or "Relate to" issue relation to jira
- Add different issue types, now is only "bug"
- Maybe add direct api import from bugzilla to jira, no need to generate csv file