Skip to main content

PyPI version Build Status

bugzilla2gitlab

Introduction

This is a tool for developers or admins who want to migrate the issue management for their software project from Bugzilla to Gitlab Issues. Here is a screenshoot of an issue created by bugzilla2gitlab: bugzilla2gitlab created issue

bugzilla2gitlab copies over bugs, bug comments and attachments.

Installation

This library is very much under development. That said, if you like to feel the wind in your hair, simply pip install bugzilla2gitlab.

More than likely, you will need to roll up your sleaves and hack on the package to achieve a migration that you are happy with. In this case:

git clone git@github.com:xmunoz/bugzilla2gitlab.git
cd bugzilla2gitlab
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# installs this package locally
pip install .

bugzilla2gitlab is compatible with python 3.7, 3.8, 3.9, and 3.10.

Usage

bugzilla2gitlab synchronously migrates a user-defined list of bugzilla bugs to a single GitLab project. There are two interfaces for this library. The command line usage:

$  bin/bugzilla2gitlab -h
usage: bugzilla2gitlab [-h] [FILE] [CONFIG_DIRECTORY]

Migrate bugs from Bugzilla to GitLab Issues.

positional arguments:
  [FILE]              A file containing a list of Bugzilla bug numbers to
                      migrate, one per line.
  [CONFIG_DIRECTORY]  The directory containing the required configuration
                      files.

optional arguments:
  -h, --help          show this help message and exit

This package can also be used as a python module.

from bugzilla2gitlab import Migrator

client = Migrator(config_path="/path/to/config")
bugs_list = [1,2,3,4,5,6,7]
client.migrate(bugs_list)

Configuration

To begin using bugzilla2gitlab, the following list of configuration files is required in the specified config directory:

  • defaults.yml: Core default values used throughout the modules.
  • user_mappings.yml: key, value pairs of Bugzilla usernames to GitLab users
  • component_mappings.yml: key, value pairs of Bugzilla components to Gitlab labels

Samples of all of these files with documentation for each configuration variable can be found in tests/test_data/config.

bugzilla2gitlab creates issues and comments in GitLab with the user accounts specified in user_mappings.yml, perserving the integrity of the original Bugzilla commenter. This, however, may not always be possible. In tests/test_data/config/user_mappings.yml, users with the designation "bugzilla" may have left the organization and therefore not have current GitLab accounts, or might simply be machine users. Comments for such users will be left under a generic "bugzilla" account. bugzilla2gitlab doesn't create any new user accounts. All of the accounts specified in user_mappings.yml must already exist in your GitLab installation.

The default table created in the issue description by bugzilla2gitlab looks like this:

Bugzilla Link 570755
Created on Jun 08, 2010 10:25
Version unspecified
OS All
Architecture All
Attachments a_PHP_play_script_to_demonstrate_how_the_browser_requests_videos
Reporter mozilla

To modify this table, take a look at create_description in models.py.

How it works

GitLab

Gitlab has a comprehensive and extensively documented API. Here are the main endpoints that this library makes use of.

Calls to the Gitlab API must be made with an administrator private token in order to impersonate other users.

Bugzilla

This program relies on being able to fetch bug data by simply appending &ctype=xml to the end of the bugzilla bug url, and then parsing the resultant xml. If this trick doesn't work on your bugzilla installation, then bugzilla2gitlab probably won't work for you.

Caveats

Every comment or mention in GitLab typically sends a notification. This is true even for comments/issues created programatically. To avoid users inboxes being flooded with meaningless email notifications and avoid overwhelming your SMTP servers, GitLab users should disable all email notifications (global and group-specific) just prior to the running of this script. This can be done through the Gitlab UI.

Further, this tools requires Gitlab sudo. If you need a tool that works without sudo, take a look at FreeDesktop's migration tool.

Demo

If you want to test out this library on a non-production GitLab instance, I recommend starting up a one-click GitLab droplet from DigitalOcean. From there, you can create a code repository, add some user accounts, and take bugzilla2gitlab for a spin.

Contributing

Check out CONTRIBUTING.md.

Release files for bugzilla2gitlab 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bugzilla2gitlab 2.0.1
File Size Uploaded
bugzilla2gitlab-2.0.1.tar.gz 78.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bugzilla2gitlab 2.0.1
File Interpreter ABI Platform
bugzilla2gitlab-2.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 93.1 kB

Release files / bugzilla2gitlab-2.0.1.tar.gz

Download URL bugzilla2gitlab-2.0.1.tar.gz
Size 78.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a7525ca82753893de432167bd267283197553900581627a20d60aea342e61875
BLAKE2b-256 checksum
How to use checksums
765bf4339060c1f7d5165b2045778f39ec2da8550dfe5cd34760be6f87b11cad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / bugzilla2gitlab-2.0.1-py2.py3-none-any.whl

Download URL bugzilla2gitlab-2.0.1-py2.py3-none-any.whl
Size 14.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b1904c811d680cc8ae702cd34c8cbbe9503b04d02a7c225f4c2e53d4ac09918c
BLAKE2b-256 checksum
How to use checksums
366790ddfbe01ff56a4b768ada001a0beadd64630629af4c7e79e3d017d2445e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page