Perforce
Defect Tracking Integration Project
Perforce Defect Tracking Integration Administrator's Guide
Richard Brooksby,
Ravenbrook
Limited, 2000-08-10
Contents
1. Introduction
This manual is the Perforce Defect Tracking Integration Administrator's
Guide. It explains how to install, configure, maintain, and administer
the Perforce Defect Tracking Integration (P4DTI).
This document is intended for P4DTI
administrators. Ordinary users of the defect tracker or Perforce should
read the Perforce Defect Tracking Integration
User's Guide. (For ideas on how to train your users on the P4DTI,
see section 8, "Training and documentation".)
This guide does not describe the basics of using the P4DTI,
Perforce, or the defect tracker. Read the Perforce
Defect Tracking Integration User's Guide to understand the P4DTI
from a user's perspective.
2. Overview of the P4DTI
2.1. Installation, configuration,
and maintenance
To install and run the P4DTI,
you must:
-
Get and install the required software (section 3).
-
Ensure you have met the procedural prerequisites for Perforce and your
defect tracker (section 3).
-
Download and install the P4DTI
software (section 4).
-
Configure the P4DTI
software (section 5).
-
Migrate defect tracking data from your defect tracker to the integrated
system (section 6).
-
Test the installation (section 7).
-
Train the users (section 8).
-
Go live (section 9).
-
Maintain the installation (section 9).
2.2. How the P4DTI
works
The P4DTI
works by taking over the job tracking system of Perforce and making the
defect tracker's records appear as Perforce jobs. Perforce users can work
with jobs more or less as described in the Perforce manuals, and their
changes are reflected in the defect tracker. For more information on how
Perforce handles jobs, see the Perforce
Command Line User's Guide.
Perforce has a mechanism for linking jobs to changelists (the p4
fix command), to enable you to record the work done for a particular
reason. The P4DTI
makes these links appear in the defect tracker, making it easy to see what
was done or is currently being done to resolve a defect.
The P4DTI
replicator is a process that copies data between a defect tracker and a
Perforce server to keep each one up to date with changes made in the other.
This approach allows developers to do their routine defect resolution work
entirely from their Perforce client, without using the defect tracker's
interface. It also allows developers to relate their changes to defect
tracking issues.
Figure 1 shows how the replicator communicates
with the defect tracking server and the Perforce server.
The replicator maintains a one-to-one relationship between issues
in the defect tracker's database and jobs in the Perforce
repository. (An issue is a unit of work that the defect
tracker tracks; some examples are bugs, change requests, and enhancement
requests.) In other words, each issue has a corresponding job, and vice
versa. The replicator keeps the contents of a configurable set of fields
in the defect tracker's issues the same as the contents of the corresponding
Perforce job, so that editing one edits the other.
The replicator also copies Perforce's links between jobs and changelists
(called "fixes") to the defect tracker's database, and makes them visible
in the defect tracker's user interface. Replication of links from Perforce
to the defect tracker makes it possible to track, record, and check a number
of things; in particular, it makes it possible to track and record the
changes made for each issue, and find out why a change was made in terms
of issues.
The replicator polls the defect tracking server and the Perforce server
at regular intervals to get a list of recent changes, and attempts to propagate
these changes to the other system. If a defect tracker issue is changed
at the same time as the corresponding Perforce job, the replicator sends
an e-mail with the overwritten Perforce job data to the following people:
-
The person who changed the job in Perforce.
-
The owner of the defect tracker issue.
-
The P4DTI
administrator.
Most defect trackers have an idea of workflow--a set of
rules that control who can do what to which issues. The replicator enforces
the defect tracker's workflow by rejecting changes to jobs in Perforce
that are illegal in the defect tracker. When it comes across such a change,
it undoes the change and sends an e-mail message to the user.
The defect tracker manages the defect tracker records (and therefore
the job contents), while Perforce manages the changelists. Neither side
controls the "fixes" relationship--the links between jobs and changelists.
Figure 1 shows how the replicator connects to
the Perforce and defect tracker servers.
Figure 1. The replication
architecture
2.3. Limitations: will the P4DTI
work for your organization?
The P4DTI
won't work well for every organization. In particular, it has the following
limitations:
If you're using TeamTrack and your workflow is very complex then the P4DTI
may make mistakes when translating actions in Perforce into actions in
TeamTrack.
(This is because TeamTrack supports operations that can't be represented
in Perforce, such as a "transition" between two states in a workflow. When
someone edits a job in Perforce, the P4DTI
tries to guess which TeamTrack transition was meant by looking at the state
you started with and the state you ended up in. However, if you have multiple
transitions between the same two states, then it may guess wrongly. See
section 3.3.2, item 6 for details of workflows
that the P4DTI
may have trouble with.)
If you have automation that makes very frequent changes to records in
the defect tracker, then users may be unable to edit jobs from Perforce.
(This is because the P4DTI
works by polling the databases every 10 seconds (by default). If there
are many updates to the defect tracker in this period then the data in
Perforce will be out of date; any attempt to edit out-of-date data is rejected
by the P4DTI
because that would introduce inconsistencies.)
3. Prerequisites for installing
the P4DTI
3.1. Required experience
To administer the P4DTI,
you must have the following experience:
-
Perforce: You need at least two months of Perforce administration experience,
including a working knowledge of Perforce's command line interface. Read
both the Perforce
Command Line User's Guide and the Perforce
System Administrator's Guide.
-
The Python programming language: You need to know how to use Python to
assign values to variables, but you do not need to be an expert Python
programmer. To acquire a basic familiarity with Python, read the Python
tutorial at <http://www.python.org/doc/current/tut/tut.html>.
-
The defect tracker: You must understand how to administer the defect tracker
and how it is configured at your organization, or have someone with that
knowledge on hand when installing, configuring, and testing the P4DTI.
3.2. Perforce prerequisites
3.2.1. Software prerequisites
Before installing the P4DTI,
you must obtain and install the following software:
-
Perforce server software of version 2000.2 or later. You can download server
and client upgrades from the Perforce FTP server at <ftp://ftp.perforce.com/pub/perforce/>.
Be sure to read the release notes (available from <http://www.perforce.com/>)
before you install. Contact
Perforce technical support if you need help.
-
Perforce client software of version 2001.1 or later for every P4DTI
user who uses Perforce, and for the P4DTI
itself.
-
Perforce licenses for every defect tracker user who is going to work in
Perforce.
-
A background user license for the replicator. This is a license
for an automatic process, rather than a person. Perforce provides background
licenses free of charge; contact
Perforce Customer Service to get one.
3.2.2. Procedural prerequisites
Before installing the P4DTI,
you must do the following:
-
Back up your Perforce repository. For instructions, see the Perforce
System Administrator's Guide.
-
Copy out of Perforce any jobs that you want to keep. The P4DTI
takes over the jobs subsystem of Perforce and rewrites the Perforce jobspec,
and you must delete all jobs from your Perforce repository as part of configuring
the P4DTI.
For more information, see section 5.2.3, "Deleting
Perforce jobs". You might want to enter any active jobs into the defect
tracking system.
-
Determine the address and port number of your Perforce server. You will
need this information when you configure the P4DTI
in section 5, "Configuring the P4DTI,
Perforce, and the defect tracker".
It is possible to keep existing issues that are stored in Perforce jobs.
Migration submits all the Perforce job data to the defect tracker, so that
the issues can be replicated back to Perforce, and so appear in both systems.
This requires more experience of Perforce and some Python programming.
See section 4, "Migrating to the
defect tracker from Perforce jobs", of the Perforce
Defect Tracking Integration Advanced Administrator's Guide.
3.3. TeamTrack prerequisites
3.3.1. Software prerequisites
Before installing the
P4DTI,
you must obtain and install the following software:
-
TeamTrack version 4.5, 5.0, or 5.5. TeamTrack is available for download
from TeamShare's web site <http://www.teamshare.com/>.
Note
that TeamTrack 5.01 and 5.02 are not supported: you should upgrade to TeamTrack
5.5.
-
TeamTrack licenses for every Perforce user who will create or own issues.
-
An extra TeamTrack license for the replicator. TeamShare provides licenses
free of charge for this purpose. Contact your TeamShare sales representative
to get one.
-
Python 2.0 for Windows, installed on the TeamTrack server machine. Python
2.0 is available from <http://www.ravenbrook.com/project/p4dti/import/2000-10-18/Python-2.0/BeOpen-Python-2_0.exe>.
-
The Python interface to Windows, installed on the TeamTrack server machine.
This is available from <http://www.ravenbrook.com/project/p4dti/import/2001/python-win32all-138/win32all-138.exe>.
You can omit this step if you don't plan to do either of the following:
3.3.2. Procedural prerequisites
Before installing the
P4DTI,
you must do the following:
-
Back up your TeamTrack database. For instructions, see the TeamTrack
Administrator Manual for your version of TeamTrack.
-
Obtain Administrator-level access to the TeamTrack server machine.
-
Ensure you have at least 5MB of free disk space for the P4DTI,
plus space for logs.
-
Ensure that your TeamTrack users do not have TeamShare's SourceBridge
plug-in installed. SourceBridge prevents the P4DTI
from working properly.
-
Ensure that your TeamTrack server is not running on a secure web server
(that is, the URL to connect to TeamTrack starts with http:, not
https:). The P4DTI
does not support TeamTrack running on a secure web server.
-
Check the workflows defined
in your TeamTrack database to make sure that they are compatible with the P4DTI.
In particular:
Make sure you don't have two states with the same name in
a project. For example, when using the workflow in figure
2, there's no way for a developer using Perforce to resolve the issue
and assign it to the tester. The developer would normally resolve the issue
by changing the status field, but in this workflow the status field doesn't
change. Rename states so that the workflow has unique state names. For
example, in figure 2, name the second "Assigned"
state "Resolved".
Figure 2. Workflow with two
states with the same name
Make sure you don't have two transitions between the same two states, in
the same direction. For example, when using the workflow in
figure
3, when the developer using Perforce changes the state of the job from
"assigned" to "resolved", the P4DTI
has no way to work out which transition to apply. Simplify the workflow
so that the transition can be deduced from the start state and the end
state. For example, in figure 3 you could have
a single transition from "Assigned" to "Resolved" and require developers
to specify how they resolved the problem in a field in the defect.
Figure 3. Workflow with two
transitions between the same two states (in the same direction)
Make sure you don't have "Update" transitions (transitions from a state
to itself) that are necessary in your workflow. For example, when using
the workflow in figure 4, there's no way for the
developer to cause the "Assign to tester" transition using Perforce. The
developer would normally resolve the issue by changing the status field,
but in this workflow the status field doesn't change. Simplify the workflow
so that it doesn't rely on "Update" transitions.
Figure 4. Workflow with a
necessary "Update" transition
In fact these problems only matter when the problematic part of the workflow
needs to be carried out in Perforce. As long as you know that the problematic
part of workflow is only carried out in TeamTrack, then the P4DTI
will work fine.
-
Ensure that the workflows defined in your TeamTrack database do not require
more than one transition in quick succession from Perforce. TheP4DTI
can't infer more than one transition at once. To avoid this problem, design
your workflow only with only single steps in Perforce. This is usually
straightforward: developers using the Perforce interface only need to transition
issues from, for example, "assigned" to "closed", and not through a series
of states.
-
Ensure that your users have the same e-mail address in TeamTrack and in
Perforce; see section 3.5, "Matching users".
3.4. Bugzilla prerequisites
3.4.1. Software prerequisites
Before installing the
P4DTI,
you must obtain and install the following software:
-
Bugzilla 2.10, 2.12, 2.14, or 2.14.1. You can download Bugzilla 2.14.1
from <http://www.ravenbrook.com/project/p4dti/import/2002-01-05/bugzilla-2.14.1/bugzilla-2.14.1.tar.gz>.
Note: If you've changed your Bugzilla code, see section
5.4.1, "Patching Bugzilla".
-
For installing Bugzilla 2.14.1 on Win2000, you will have to tweak some
code to make it work.You can also download Bugzilla 2.14.1 for windows
from <http://www.parrus.com/project/p4dti>.
-
MySQL 3.22.19 or later. You must be using Bugzilla with this database manager.
Note that Bugzilla itself may not work with MySQL 3.23.29.
-
Python 1.5.2 or later, installed on the Bugzilla server machine. Python
1.5.2 sources are available from <http://www.ravenbrook.com/project/p4dti/import/1999-04-13/python-1.5.2/python-1.5.2.tar.gz>.
If you build Python from the sources, note that the P4DTI
requires the optional syslog module. An RPM
of Python 1.5.2 for RedHat Linux 6.2 is available from <http://www.ravenbrook.com/project/p4dti/import/1999-04-13/python-1.5.2/python-1.5.2-13.i386.rpm>.
An RPM of Python 1.5.2
for RedHat Linux 7.0 is available from <http://www.ravenbrook.com/project/p4dti/import/1999-04-13/python-1.5.2/python-1.5.2-27.i386.rpm>.
-
The MySQLdb Python package, release 0.2.2 to 0.9.1, installed on the Bugzilla
server machine. (MySQLdb releases before 0.2.2 are known to be incompatible
with the P4DTI;
MySQLdb releases after 0.9.1 haven't been tested.) MySQLdb 0.9.1 is available
from <http://www.ravenbrook.com/project/p4dti/import/2001-10-16/MySQL-python-0.9.1/MySQL-python-0.9.1.tar.gz>.
To build MySQLdb, you need the Python header files, which come with Python
1.5.2 but are not included in the Python 1.5.2 RPMs mentioned above. They
are included in the python-devel RPMs for RedHat Linux 6.2: <http://www.ravenbrook.com/project/p4dti/import/1999-04-13/python-1.5.2/python-devel-1.5.2-13.i386.rpm>
or for RedHat Linux 7.0: <http://www.ravenbrook.com/project/p4dti/import/1999-04-13/python-1.5.2/python-devel-1.5.2-27.i386.rpm>.
To install bugzilla on win2000 you need to download the Mysql python zip
package, MySQL-python-0.9.1.win32-py2.2.zip from <http://www.parrus.com/project/p4dti>.
Refer to the release notes for the complete software configuration.
3.4.2. Procedural prerequisites
Before installing the
P4DTI,
you must do the following:
-
Back up your Bugzilla database. For instructions, see the MySQL
manual (under "Database Backups", section 21.2 at the time of writing).
-
Back up your Bugzilla code. As part of P4DTI
installation, you must apply a patch to Bugzilla (for details, see section
5.4.1, "Patching Bugzilla"). A backup of your Bugzilla code is useful
if you need to uninstall the P4DTI.
-
Ensure that you have at least 2MB of free disk space on the Bugzilla server
machine for the P4DTI,
plus space for logs.
-
Ensure that your users have the same e-mail address in Bugzilla and in
Perforce; see section 3.5, "Matching users".
3.5. User accounts
You must ensure that the P4DTI
can work out how users in the defect tracker correspond to users in Perforce,
as follows:
Create an account in each system for each user who needs to use the
integrated system.
If you are using Bugzilla, create a Bugzilla account
for every user in Perforce.
If you are using TeamTrack, then you must make sure
that every Perforce user who needs to edit or fix defects has an account
in TeamTrack. (If you're short of licenses, then there's no need for other
TeamTrack users to have accounts in Perforce, or for Perforce users who
don't do defect resolution to have accounts in TeamTrack.)
Make sure that each user has the same e-mail address in the defect tracker
and in Perforce. The P4DTI
uses e-mail address to match up users between the two systems.
(This is necessary in the Bugzilla integration where your e-mail address
is used as your userid. In the TeamTrack integration this allows the P4DTI
to work in organizations where users have been assigned different userids
in the two systems.)
The
P4DTI
supports Bugzilla's "emailsuffix" feature (once you've applied the Bugzilla
patch,
section 5.4.1, and turned on the
P4DTI
extensions in Bugzilla,
section 5.4.3), so
if you have "emailsuffix" set to "@company.domain", then the user "joe"
in Bugzilla will match a user in Perforce with the e-mail address "joe@company.domain".
There are three problems that can occur if the P4DTI
can't match up users properly:
-
If someone changes a job in Perforce but the P4DTI
can't find a matching user in the defect tracker, then the change to the
job is disallowed (because the defect tracker requires that changes be
made only by users with the right privileges).
-
If two users in Perforce have the same e-mail address then theP4DTI
chooses the first one it finds when matching a user from the defect tracker.
This choice is likely to be incorrect.
-
If two users in TeamTrack have the same e-mail address then theP4DTI
chooses the first one it finds when matching a user from Perforce. This
choice is likely to be incorrect.
To help you prevent these problems, each time you start the P4DTI
it sends an e-mail message to the administrator containing a report listing
the unmatched and duplicate users. An example report is shown in figure
5. Read reports you receive and fix the problems.
Figure 5. Example e-mail sent
when the P4DTI
starts
|
Date: Tue, 2 Oct 2001 15:26:12 +0100 (BST)
From: p4dti-replicator0@company.domain
To: P4DTI administrator <p4dti-admin@company.domain>
Subject: (P4DTI-8669) The P4DTI replicator has started.
(P4DTI-8658) This is an automatically generated e-mail from the Perforce Defect
Tracking Integration replicator 'replicator0'.
(P4DTI-8669) The P4DTI replicator has started.
|
| 1 |
(P4DTI-867X) The following Perforce users do not correspond to defect tracker
users. The correspondence is based on the e-mail addresses in the defect
tracker and Perforce user records.
(P4DTI-6302) These Perforce users will appear in TeamTrack as the user (None).
It will not be possible to assign issues to these users.
User E-mail address
-----------------------
nickb nickb@client
|
| 2 |
(P4DTI-8705) The following defect tracker users do not correspond to Perforce
users. The correspondence is based on the e-mail addresses in the defect
tracker and Perforce user records.
(P4DTI-6299) These TeamTrack users will appear as themselves in Perforce even
though there is no such Perforce user.
User E-mail address
------------------------
nb nb@company.domain
|
| 3 |
(P4DTI-6379) These Perforce users have duplicate e-mail addresses. They may
have been matched with the wrong TeamTrack user.
User E-mail address
------------------------
root ndl@company.domain
ndl ndl@company.domain
|
| 4 |
(P4DTI-6368) These TeamTrack users have duplicate e-mail addresses. They may
have been matched with the wrong Perforce user.
User E-mail address
------------------------
admin rb@company.domain
rb rb@company.domain
|
|
Notes on figure 5:
Section
1 lists Perforce users that couldn't be matched to a user in the defect
tracker (here TeamTrack). Here the user hasn't set their e-mail address
in Perforce: they still have the default.
Section
2 lists defect tracker users that couldn't be matched to a user in
Perforce.
Section
3 lists Perforce users with duplicate e-mail addresses. In this case,
if a defect tracker user had the address <ndl@company.domain> then the P4DTI
may have matched them wrongly. Give each Perforce user a distinct e-mail
address.
Section
4 lists defect tracker users with duplicate e-mail addresses. Give
each defect tracker user a distinct e-mail address.
4. Installing the P4DTI
Note: You might want to practice installing and configuring the P4DTI
using a test Perforce repository and a test defect tracking database before
you try it with your real data. A copy of your real Perforce repository
would be ideal; for instructions on how to make a copy of your repository,
see the Perforce
System Administrator's Guide.
The installation for p4dti for bugzilla on Win2000 is distributed as
p4dti-bugzillawin-1.4.2.exe. Transfer this to the local machine and run
"p4dti-bugzillawin-1.4.2."
Installing bugzilla on Win2000 to work with P4DTI is a two step
process. Bugzilla-2.14.1 is not supported by the Bugzilla team on Windows.
One needs to tweak the code to make it work. Further, the P4DTI changes
for Bugzilla needs to be applied on top of Bugzilla.
The p4dti-kit-bugzillawin-1.4.2 contains bugzilla code that works with
p4dti but contains only the minimal features. The complete bugzilla code
can be downloaded from http://www.parrus.com/project/p4dti.
5. Configuring the P4DTI,
Perforce, and the defect tracker
Work through the subsections in the order in which they appear. Do not
attempt to run the P4DTI
until you have reached the end of this section, or you might end up with
a non-working installation.
To configure the P4DTI
with Perforce and your defect tracker, you must:
-
Specify the location of servers and the data you want to appear in Perforce
(section 5.1).
-
Configure Perforce to accept information from the replicator and, optionally,
install triggers to implement access controls (section
5.2).
-
Enable P4DTI
features, such as the ability to view fixes and changelists from the defect
tracker user interface (section 5.3 for TeamTrack
or section 5.4 for Bugzilla).
-
Start the replicator (section 5.5).
-
Set up the replicator to start automatically when the server machine is
rebooted (section 5.6).
5.1. P4DTI
configuration
To configure the P4DTI,
you edit definitions of Python variables in the file config.py
in the installation directory. Edit these definitions according to the
notes below. All variables in the file must have a value.
5.1.1. Essential configuration
parameters
dt_name
Description: The name of the defect tracking system you're integrating
with. Either "TeamTrack" or "Bugzilla".
Example: "TeamTrack"
Make sure that this variable is set to the appropriate value for your
defect tracker.
administrator_address
Description: The e-mail address of the P4DTI
administrator.
Example: "p4dti-admin@company.domain"
The replicator sends error reports to this address. If this is
None,
then the replicator never sends e-mail.
p4_port
Description: The address and port of the Perforce server with which the
replicator communicates.
Example: "perforce.company.domain:1666"
p4_user
Description: The userid that the replicator uses to log in to the Perforce
server.
Example: "p4dti-replicator0"
For information about how the replicator logs in to Perforce, see section
5.2, "Perforce configuration". If you want to add more replicators
later, incorporate the replicator identifier (rid)
into this userid.
p4_password
Description: The password the replicator uses to log in to the Perforce
server. If there is no password, specify "" (empty quotes).
Example: ""
For information about how the replicator logs in to Perforce, see section
5.2, "Perforce configuration".
replicator_address
Description: The e-mail address from which the replicator sends e-mail.
This address is used in the "From" field of e-mail that the replicator
sends.
Example: "p4dti-replicator0@company.domain"
To make it easier for users to get assistance, make this address an
alias for the administrator e-mail
address (administrator_address). If you are using Bugzilla,
this e-mail address is also used for the replicator's Bugzilla account;
see section 5.4.2, "Creating a Bugzilla user for
the replicator".
smtp_server
Description: The address of the SMTP server that the replicator uses to
send e-mail.
Example: "smtp.company.domain"
If this is None, then the replicator never sends e-mail.
If you need to run the P4DTI
without being connected to a network (for example, if you want to set it
up on a laptop so that you can give a demonstration), set smtp_server=None
so that the replicator doesn't try to send e-mail.
start_date
Description: The starting point in time for replication.
Example: "2001-02-10 00:00:00"
Issues modified after this date are replicated; issues unchanged after
this date are ignored. Must be a string in the form "YYYY-MM-DD HH:MM:SS".
5.1.2. TeamTrack configuration
parameters
teamtrack_version
Description: The major version of your TeamTrack server. Specify
"4.5"
for TeamTrack 4.5, or
"5.0" for TeamTrack 5.0 or later.
Example: "5.0"
closed_state
Description: The TeamTrack that maps to the "closed" state in Perforce.
Specify
None if you want the ordinary state mapping rules to apply.
(Note that you must write None literally, not the string "None",
which would mean the state called "None").
Example: "Resolved".
Mapping the TeamTrack state that developers use most often to the "closed"
state in Perforce makes using the P4DTI
easier for the developers, because the Perforce user interfaces make it
easier to fix a job to "closed" than any other state. However, if your
workflow already has a state called "Closed", then you can't use this feature;
set closed_state = None.
replicated_fields
Description: A list of the database names of TeamTrack fields that are
replicated in Perforce. The fields
STATE,
OWNER, and
TITLE are always replicated, so omit those fields when setting
this variable.
Example: ["DESCRIPTION", "PRIORITY", "SEVERITY"]
For advice on which fields to replicate, and how to find out their database
names, see section 5.1.5, "Choosing which fields
to replicate".
teamtrack_server
Description: The TeamTrack server hostname and (optionally) port with which
the replicator communicates.
Example: "teamtrack.company.domain"
If your TeamTrack server is reached on a path other than /tmtrack/tmtrack.dll?
then you must specify the full path to the server in this variable. For
example, "http://server.company.domain/infosystem/teamtrack/tmtrack.dll?".
(Note that "localhost" won't work, even if the TeamTrack server
is on the local host.)
teamtrack_user
Description: The user name that the replicator uses to log into TeamTrack.
Example: "P4DTI-replicator0"
See section 5.3.2, "Creating a TeamTrack user
for the replicator".
teamtrack_password
Description: The password that the replicator uses to log into TeamTrack.
If there is no password, specify "" (empty quotes).
Example: ""
See section 5.3.2, "Creating a TeamTrack user
for the replicator".
use_windows_event_log
Description: The replicator logs activity to the Windows event log if (and
only if) this is 1.
Example: 1
If you set this to 1, you must make sure to install the Python interface
to Windows (item 5 in section 3.3.1, "Software
prerequisites").
Regardless of the setting of this parameter, the replicator also logs
activity to to the standard output and to the log
file (log_file).
The replicator can generate very many log messages. So if you set this
parameter to 1, either specify "Overwrite events as needed" in the Windows
Event Viewer on the machine running the replicator, or else set the log_level
to a restrictive value like message.LOG_WARNING.
5.1.3. Bugzilla configuration
parameters
closed_state
Description: The Bugzilla state that maps to the "closed" state in Perforce.
Specify
None if you want the ordinary state mapping rules to apply.
(Note that you must write None literally, not the string "None",
which would mean the state called "None").
Example: "RESOLVED".
Mapping the defect tracker state that developers use most often to the
"closed" state in Perforce makes using the P4DTI
easier for the developers, because the Perforce user interfaces make it
easier to fix a job to "closed" than any other state. If you specify a
closed_state then the "CLOSED" state in Bugzilla maps to "bugzilla_closed"
in Perforce.
replicated_fields
Description: A list of the names of Bugzilla fields that are replicated
in Perforce. The fields "bug_status", "short_desc", "assigned_to" and "resolution"
are always replicated, so omit those fields when setting this variable.
Example: ["longdesc", "priority", "bug_severity", "product"]
For advice on which fields to replicate, see section
5.1.5, "Choosing which fields to replicate".
dbms_host
Description: The host on which the Bugzilla MySQL server is running.
Example: "localhost"
Set this value to "localhost" if the P4DTI
and the Bugzilla MySQL server run on the same machine.
dbms_port
Description: The port number on the
database
host (dbms_host), on which the Bugzilla MySQL server listens.
Example: 3306
MySQL normally listens on port 3306. Change this setting only if you
have set up MySQL differently. Note that this parameter is expressed as
a number, not as a string.
dbms_database
Description: The name of the MySQL database in which Bugzilla stores its
data.
Example: "bugs"
Normally set to "bugs" during Bugzilla installation (see the
Bugzilla documentation for 2.10,
2.12,
2.14,
2.14.1).
Change this setting only if you have set up Bugzilla differently.
dbms_user
Description: The user name that the replicator uses to log in to MySQL
to use the Bugzilla database.
Example: "bugs"
Bugzilla normally logs in to MySQL as user "bugs" (see the
Bugzilla documentation for 2.10,
2.12,
2.14,
2.14.1).
Change this setting only if you have configured Bugzilla differently, or
if you want to set up the replicator to log in as a different user.
dbms_password
Description: The password that the replicator uses to log in to MySQL to
use the Bugzilla database.
Example: ""
Bugzilla normally logs in with no password (see the Bugzilla documentation
for 2.10,
2.12,
2.14,
2.14.1).
Change this setting if you have configured Bugzilla differently, or you
want to set up the replicator to log in as a different user and use a password.
bugzilla_directory
Description: The directory in which Bugzilla is installed, or
None
if you don't want e-mail processed.
Example: "/home/httpd/html/bugzilla"
Bugzilla sends e-mail to its users when it notices that a bug has been
changed. If the P4DTI
is running on the Bugzilla server, it is able to use Bugzilla's processmail
script to promptly send e-mail in the same way. This configuration parameter
allows the P4DTI
to locate processmail. Set it to None if the P4DTI
is not running on the Bugzilla server or if you don't want the P4DTI
to send these e-mail messages.
5.1.4. Other configuration
parameters
These parameters support advanced or rarely-used features. Most organizations
can leave these parameters at their default values, at least to start with,
and then set them later if necessary.
changelist_url
Description: A format string used to build a URL for a changelist. Specify
None if there are no URLs for changelists.
This is used by the defect tracker to provide a link from a fix to a
web page providing more information about the changelist that fixed the
issue. Figure 6 shows how this works in Bugzilla.
The value must be a format string valid for passing to sprintf();
it must have one %d format specifier, for which the change number
is substituted. (Note that because the value gets passed to sprintf(),
you must double other percent signs.)
In order to use this feature, you must have a web application that can
provide information about changelists. Applications suitable for this include:
P4Web.
To allow any user to follow the link from the defect tracker to P4Web,
you need to run it in "browse mode". See the P4Web
documentation for details.
For P4Web, set changelist_url to something like "http://info.company.domain:8080/%d?ac=10".
Perfbrowse.
For Perfbrowse, set changelist_url to something like "http://info.company.domain/cgi/perfbrowse.cgi?@describe+%d".
Figure 6. Effect of changelist_url
and job_url
job_url
Description: A format string used to build a URL for job descriptions.
Specify None if there is no URL for job descriptions.
This is used by the defect tracker to provide a link from an issue to
a web page providing more information about the job that corresponds to
the issue. Figure 6 shows how this works in Bugzilla.
Example: "http://info.company.domain/cgi/perfbrowse.cgi?@job+%s"
The string is a format string valid for passing to sprintf();
it must have one %s format specifier, for which the job name is
substituted. (Note that because it gets passed to sprintf(), you
must double other percent signs.)
log_file
Description: The name of the replicator's log file. If None, messages
aren't logged to any file. (Note that you must write None literally,
not the string "None", which would mean the file called "None").
Example: "C:\\Program Files\\P4DTI-RELEASE\\p4dti.log"
The replicator generates log messages to record its actions. These log
messages are sent to all of the following locations:
-
The standard output of the replicator.
-
The system log (under UNIX and Linux).
-
The event log (under Windows, if use_windows_event_log
is 1).
-
The file specified by the log_file configuration parameter (unless
it's None).
log_level
Description: The minimum priority level of messages to log. Messages with
this priority or a higher priority appear in the replicator's log.
Example: message.INFO
This parameter must be one of these constants:
| message.ERR |
Errors. |
| message.WARNING |
Warnings; that is, features of your system that the replicator can
work around, but which you should pay attention to. For example, "Table
'PROJECTS' has two entries called 'Compiler'.". |
| message.NOTICE |
Significant but expected events. For example, "Job 'BUG00001' overwritten
by issue 'BUG00001'.". |
| message.INFO |
Informational messages. For example, "Replicating issue '123' to job
'BUG000123'." |
| message.DEBUG |
Debugging messages. For example, "Perforce command: 'p4 -G -u p4dti-replicator0
-p perforce:1666 job -o BUG00001'." |
p4_client_executable
Description: The location of the Perforce client executable.
Example: "C:\\Program Files\\Perforce\\p4.exe"
This setting doesn't need to be an absolute path name if the directory
is on the replicator user's path. On Windows this setting might be "C:\\Program
Files\\Perforce\\p4.exe". On UNIX it might be just "p4".
The client executable named by this parameter must be of version 2000.2
or later (run the command p4 -V to check the client version),
and it must be the same version as the Perforce server you are connecting
to. If there's a mismatch between the Perforce client executable and the
Perforce server, then you might see the error message (P4DTI-7087)
Value for field 'Options' must be one of ....
p4_server_description
Description: A description of the Perforce server. This might be used by
the defect tracker to show which Perforce server an issue is replicated
to.
Example: "Hardware development group Perforce server"
poll_period
Description: The period of time between the end of one poll of the servers
and the start of the next, in seconds.
Example: 10
prepare_issue(issue,
job)
Description: A function that prepares a new issue for submission to the
defect tracker by providing values for all the required fields.
See section 3, "Allowing users
to create issues in Perforce" in the Perforce
Defect Tracking Advanced Administrator's Guide for the full details.
replicate_p(issue)
Description: A function that selects which issues to start replicating.
Normally, the P4DTI
replicates all issues created or modified after the start_date,
but you can modify this function to further restrict the issues.
See section 2, "Select the issues
to replicate" in the Perforce Defect
Tracking Advanced Administrator's Guide for the full details.
replicate_job_p(job)
Description: A function that selects which jobs in Perforce to replicate.
Normally, the P4DTI
ignores jobs created in Perforce, but you can provide this function to
allow users to create jobs in Perforce and have them replicated to the
defect tracker.
See section 3, "Allowing users
to create issues in Perforce" in the Perforce
Defect Tracking Advanced Administrator's Guide for the full details.
rid
Description: The replicator identifier.
Example: "replicator0"
Must be 32 characters or less, start with a letter or underscore, and
consist only of letters, numbers, and underscores.
The replicator identifier is used to distinguish between replicators
when multiple replicators are being used to replicate issues from a defect
tracker to different Perforce servers. If you have only one replicator,
it doesn't matter what you use for the replicator identifier; "replicator0"
is a good choice since it allows you to add more replicators later.
If you change the replicator identifier then your currently replicated
defect tracker issues stop being replicated. The replicator believes they
are being handled by another replicator.
sid
Description: The Perforce server identifier.
Example: "perforce0"
Must be 32 characters or less, start with a letter or underscore, and
consist only of letters, numbers and underscores. You might want to use
the hostname of your Perforce server, if it is stable.
use_deleted_selections
Description: If this is 1, deleted TeamTrack states and selections appear
as options for corresponding fields in Perforce. If this is
0,
they don't appear in the Perforce jobspec or in drop-down menus in P4Win.
Example: 0
Warning: It is risky to set this to 0 because TeamTrack never
really deletes a state or selection; it just marks it as deleted. So you
may have issues in TeamTrack that use those deleted states and selections.
If use_deleted_selections is
0 then these issues can't
be replicated to Perforce. If this happens, you'll see errors like these:
use_perforce_jobnames
Description: Determines whether the replicator uses Perforce-style jobnames.
If this parameter is 1, the P4DTI
lets Perforce choose the names of the jobs it creates when replicating
issues from the defect tracker (so jobs will be named job000001, job000002
and so on). This means that the job name won't match the name of the corresponding
issue in the defect tracker.
If this parameter is 0 (the default), the P4DTI
tries to match the defect tracker's names for the issues it replicates. In
the TeamTrack integration, jobs are called BUG00001, ENH00002, and so on.In
the Bugzilla integration, jobs are called bug1, bug2, and so on.
Example: 1
If you change this setting, the P4DTI
doesn't rename existing jobs, but new jobs get the style of name you requested.
5.1.5. Choosing which fields
to replicate
Here's some advice on which fields to replicate:
-
Replicate any fields that the developers are required to fill in, or they
won't be able to use Perforce to do their work.
-
Replicate any other fields that the developers need to do their work; see
the suggestions below.
-
Don't replicate other fields--the less information developers need to enter,
the better the quality of that information. Keeping the number of replicated
fields low might mean modifying your workflows so that unnecessary fields
can be omitted. For example, you might have a FIX_DESCRIPTION
field for developers to explain what they did. Now that you're running
the P4DTI,
you don't need that field--you can look in the change comments of the associated
changelists to find out what the developer did--so leave it out.
-
Note that Perforce has no protections for jobs. This means that any user
of Perforce can read all fields of all the jobs. So if you have confidential
information in issues, keep that information out of Perforce, for example
by separating it out into a field that is not replicated.
If you're using TeamTrack's sample database, you
might want to replicate the following fields:
-
DESCRIPTION, so that developers can understand what the problem
is.
-
SEVERITY, so that developers can prioritize their work.
-
PRIORITY, so that developers can prioritize their work.
To find out the database name of a TeamTrack field, follow these steps:
-
Run the TeamTrack administrator. (Under Windows, choose Start > Programs
> TeamShare > TeamTrack Administrator.)
-
Select the Projects tab.
-
Select a project from the list (but not the base project).
-
Click the Edit button.
-
Select the Default Fields tab.
-
Select the desired field from the list.
-
Click the Edit button.
-
Look in the Database Field Name field in
the dialog.
Table 1 shows the field types in TeamTrack and indicates
which ones may be replicated by the
P4DTI.
Table 1. Supported field types
in TeamTrack
| Field type |
Field contents |
Replicable by P4DTI? |
| NUMERIC |
Numeric field, integer or floating-point |
Yes |
| TEXT |
Text field up to 255 characters |
Yes |
| MEMO |
Memo field |
Yes |
| DATETIME |
Date/Time field |
Yes |
| SELECTION |
Drop down selection field, one selectable |
Yes |
| BINARY |
Binary (two-state) field |
Yes |
| STATE |
The system-defined state field |
Yes |
| USER |
A drop down selection field containing user names |
Yes |
| PROJECT |
System-defined project field |
Yes |
| SUMMATION |
Calculated summation fields |
No |
| MULTIPLE_SELECTION |
Multi-select selection field |
No |
| CONTACT |
Contact selection field |
No |
| COMPANY |
Company selection field |
Yes |
| INCIDENT |
Incident selection field |
No |
| PRODUCT |
Product selection field |
Yes |
| SERVICEAGREEMENT |
Service Agreement |
Yes |
| FOLDER |
Folder link selection field |
No |
| KEYWORDLIST |
Keyword multi-select field |
No |
| PRODUCTLIST |
Product multi-select field |
No |
| PROBLEM |
Problem selection field. |
No |
| RESOLUTION |
Resolution selection field |
No |
| MERCHANDISE |
Merchandise selection field |
No |
| RELATIONAL |
Relational selection field |
No |
| SUBRELATIONAL |
Sub-relational selection field |
No |
| SYSTEM |
System field |
No |
| MULTIPLE_RELATIONAL |
Multiple relational selection field. |
No |
Attachments such as notes are stored in separate tables in TeamTrack and
are not replicated by the
P4DTI.
If you need to have supplementary information replicated to Perforce, use
a memo field like "Additional Notes". In TeamTrack you can turn any memo
field into a "journal" field which consists of a list of entries, each
headed with the date of the entry and the name of user who added it.
If you're using Bugzilla, you might want to replicate
the following fields:
-
"longdesc", so that developers can understand what the problem is.
-
"bug_severity", so that developers can prioritize their work.
-
"priority", so that developers can prioritize their work.
-
"target_milestone", if you use target milestones, so that developers can
prioritize their work.
-
"product", so that developers can categorize their work.
-
"component", so that developers can categorize their work.
-
"version", so that developers can categorize their work.
-
"op_sys", for additional developer information.
-
"rep_platform", for additional developer information.
-
"status_whiteboard", for additional developer information.
-
"keywords", for additional developer information.
If you're using Bugzilla, the replicator rejects the following types of
changes from within Perforce:
-
Any changes to the following types of field:
-
Fields that cannot be changed in Bugzilla, such as "creation_ts", "delta_ts",
and "lastdiffed".
-
Fields that can only be changed in Bugzilla in very restricted ways, such
as "groupset", "product", "version", "component", "target_milestone", and
"everconfirmed".
-
Fields that, when changed in Bugzilla, have complex side-effects that the
replicator can't sensibly reproduce, such as "votes" and "keywords".
-
Changes that do anything to the "longdesc" field other than appending to
it. This field can be used for long descriptions of the bug. When a Bugzilla
user adds a comment to a bug, it appears at the end of this field. Perforce
users can also only modify this field by appending to it; any text that
they append is replicated to Bugzilla as a new comment.
-
Invalid changes to fields that must contain Bugzilla users, such as "assigned_to",
"reporter", and "qacontact". These fields may contain a Perforce user name,
if the Perforce user corresponds to a Bugzilla user, or a Bugzilla user's
e-mail address. The "qacontact" field may also contain "None". If a Perforce
user changes one of these fields to some other string, the replicator rejects
the change.
The following table lists the field names for Bugzilla 2.10, 2.12, 2.14,
and 2.14.1. If you have modified Bugzilla, your field names may differ.
To display the set of Bugzilla field names, type
mysqlshow bugs bugs
at a shell prompt.
Table 2. Bugzilla field names
| Field name |
Name on Bugzilla form |
Replication policy |
| bug_id |
Bug # |
always, read only |
| bug_status |
Status |
always, read/write |
| assigned_to |
Assigned To |
always, read/write, user |
| short_desc |
Summary |
always, read/write |
| resolution |
Resolution |
always, read/write |
| bug_file_loc |
URL |
read/write |
| bug_severity |
Severity |
read/write |
| op_sys |
OS |
read/write |
| priority |
Priority |
read/write |
| rep_platform |
Platform |
read/write |
| reporter |
Reporter |
read/write, user |
| qa_contact |
QA Contact |
read/write, user or None |
| status_whiteboard |
Status Whiteboard |
read/write |
| reporter_accessible |
Reporter checkbox |
read/write |
| assignee_accessible |
Assignee checkbox |
read/write |
| qacontact_accessible |
QA Contact checkbox |
read/write |
| cclist_accessible |
CC List checkbox |
read/write |
| longdesc |
Description |
append only |
| groupset |
- |
read only |
| creation_ts |
Opened |
read only |
| delta_ts |
- |
read only |
| product |
Product |
read only |
| version |
Version |
read only |
| component |
Component |
read only |
| target_milestone |
Target Milestone |
read only |
| votes |
Votes |
read only |
| keywords |
Keywords |
read only |
| lastdiffed |
- |
read only |
| everconfirmed |
- |
read only |
The following fields are displayed on the Bugzilla bug form but are kept
in separate database tables and cannot be replicated:
-
"Cc"
-
"Attachments"
-
"Depends on"
-
"Blocks"
If you need to change the list of replicated fields after you've started
using the P4DTI,
see section 9, "Maintaining the P4DTI".
5.2. Perforce configuration
To configure Perforce, you must:
-
Create a Perforce user for the replicator (section
5.2.1).
-
Install Perforce triggers to enforce workflow (optional; section
5.2.2).
-
Delete all Perforce jobs, if you have not already done so (section
5.2.3).
5.2.1. Creating a Perforce
user for the replicator
Create a user in Perforce for the replicator; for instructions, see the
Perforce
System Administrator's Guide. The replicator user must have the
following properties:
For information on getting a license from Perforce Software for this extra
user, see section 3.2, "Perforce prerequisites".
5.2.2. Installing Perforce
triggers to enforce workflow
You can use the P4DTI
in combination with a Perforce trigger to enforce extra
workflow restrictions. For example, if your organization assigns priorities
to issues, you can prevent changes being made to areas of the repository
unless they resolve at least one defect of priority 3 or higher.
The P4DTI
comes with an example trigger script that you can adapt for your needs,
installed as example_trigger.py in the default installation directory.
To enforce workflow restrictions, follow these steps:
-
Configure the P4DTI
to replicate the defect tracker fields that you want to check. For example,
you can check that the "priority" or "severity" is above a certain level,
or that a manager has set the "approval" field. See the replicated_fields
configuration parameter (for Bugzilla
or TeamTrack).
-
Adapt the trigger script for your needs. You must be able to do a small
amount of Python programming to adapt the trigger script. The example script
contains comments to help you.
-
Install the trigger script. For instructions on installing and managing
trigger scripts, see the Perforce
System Administrator's Guide.
5.2.3. Deleting Perforce
jobs
You must delete all jobs from your Perforce installation. The P4DTI
takes over the jobs subsystem of Perforce and rewrites the Perforce jobspec.
For instructions, see the Perforce
Command Line User's Guide.
It is possible to keep existing issues that are stored in Perforce jobs.
Migration submits all the Perforce job data to the defect tracker, so that
the issues can be replicated back to Perforce, and so appear in both systems.
This requires more experience of Perforce and some Python programming.
See section 4, "Migrating to the
defect tracker from Perforce jobs", of the Perforce
Defect Tracking Integration Advanced Administrator's Guide.
If you already use Perforce jobs and have significant tools that depend
on your jobspec, the configuration options described in section
5.1, "P4DTI configuration",
might not be flexible enough to support your requirements. However, you
might be able to write your own configuration and use your own jobspec.
To write your own configuration, you must understand the P4DTI
configuration architecture and be fluent in the Python programming language.
See the Perforce Defect Tracking Integration Integrator's Guide
for details of how to configure the P4DTI
and guidance on developing your own configuration. Note that neither Perforce
nor the manufacturer of your defect tracker can support a configuration
that you write yourself.
5.3. TeamTrack configuration
To configure TeamTrack, you must:
-
Update the Windows Registry (section 5.3.1).
-
Create a TeamTrack user for the replicator (section
5.3.2).
-
Provide field descriptions (section 5.3.3).
5.3.1. Updating the Windows
Registry
You need to add a TeamTrack value to the Windows Registry to tell TeamTrack
that the
P4DTI
is present. To do this, double-click the
p4dti.reg file that comes
with the
P4DTI
(it's installed in
c:\program files\p4dti\p4dti.reg by default).
5.3.2. Creating a TeamTrack
user for the replicator
You need to create a TeamTrack user for the replicator. This user corresponds
to the
replicator TeamTrack userid (teamtrack_user)
parameter you set in
section 5.1, "P4DTI
configuration".
To create a TeamTrack user for the replicator, follow these steps:
-
Run the TeamTrack Administrator. (Under Windows, choose Start > Programs
> TeamShare > TeamTrack Administrator.)
-
Select the Users tab.
-
Click the Add button.
-
On the General tab, in the Login ID field,
enter the replicator user name (see the replicator
Teamtrack userid (teamtrack_user) parameter).
-
Click the User product access radio button
(see Figure 7).
-
On the Privileges tab, select the System
tab and then select the "Connect using the API"
check box (see Figure 8).
-
On the Privileges tab, select the Item
tab.
-
In the pane at the left, select the base project.
-
In the pane at the right, select the "Submit New Items",
"Update All Items" and "Transition
All Items" check boxes (see Figure 9).
-
Click OK to add the user.
For information on getting a license from TeamShare for this extra user,
see
section 3.3, "TeamTrack prerequisites".
Figure 7. New user: General
tab
Figure 8. New user: Privileges
tab, System tab
Figure 9. New user: Privileges
tab, Item tab
5.3.3. Providing field descriptions
The replicator uses TeamTrack issue field descriptions as the source for
the Perforce job field descriptions. These job field descriptions appear
in comments in every job form (if you're using the Perforce command line)
and as tooltips for the fields in the job editing dialog (if you're using
P4Win, the Perforce Windows GUI).
TeamTrack leaves field descriptions blank when you create a database,
so you must provide descriptions of fields that your developers edit. For
example, you might describe the TITLE field as "A one-sentence
statement of the problem from the user's perspective", and the DESCRIPTION
field as "A detailed description of the problem from the user's perspective,
including how to reproduce it."
To enter field descriptions, follow these steps:
-
Run the TeamTrack Administrator. (Under Windows, choose Start > Programs
> TeamShare > TeamTrack Administrator.)
-
Select the Workflows tab.
-
Select the Issue Workflow.
-
Click the Edit button.
-
Select the Default Fields tab.
-
Select the field you want to describe.
-
Click the Edit button.
-
Enter the description in the Description
field.
-
Click OK to save your entries.
-
Repeat steps 6 to 9 until you're done.
-
Click the OK button.
5.4. Bugzilla configuration
To configure Bugzilla, you must:
-
Patch Bugzilla (section 5.4.1).
-
Create a Bugzilla user for the replicator (section
5.4.2).
-
Enable the P4DTI
extensions in Bugzilla (section 5.4.3).
5.4.1. Patching Bugzilla
You need to make some minor modifications to the Bugzilla code so that
users can see Perforce information on Bugzilla bug forms, and so that the
P4DTI
can access the values of Bugzilla configuration parameters. These modifications
are distributed as patchfiles for versions 2.10, 2.12, 2.14, and 2.14.1
of Bugzilla.
If you have modified Bugzilla at your site, you might still be able
to apply the patch successfully. Changes to the database schema, the permissions
rules, or the workflow rules are likely to cause theP4DTI
to malfunction. You might need to modify the P4DTI
if you have changed these parts of Bugzilla.
The patch for all Bugzilla versions changes the following Bugzilla files:
-
bug_form.pl, adding a Perforce section to the bug form.
-
defparams.pl, adding a parameter to control whether or not the
Perforce section appears.
-
doeditparams.pl, creating and maintaining a database table containing
Bugzilla's configuration parameters.
The patches for Bugzilla 2.14 and 2.14.1 also change this file:
-
globals.pl, deleting unsafe environment variables so that the
processmail script can be run by the P4DTI.
These changes are small and self-contained. If your changes do not affect
these files or only affect them in minor ways, the patch should operate
correctly. If the patch program fails because of your Bugzilla modifications,
it might still be possible to introduce the changes by hand. If you cannot
apply the patch, the replicator might still work, but the extensions listed
in
section 5.4.3 will not be available.
To apply the patch, follow these steps:
-
Make a copy of your Bugzilla code so that you can uninstall the P4DTI
if necessary.
-
Go to your Bugzilla installation directory.
-
Enter the following command:
patch < p4dti-install-dir/bugzilla-bugzilla-version-patch
(where p4dti-install-dir is your P4DTI
installation directory) and bugzilla-version is your version of
Bugzilla (2.10, 2.12, 2.14, or 2.14.1).
-
Check the output of the patch program carefully to ensure it succeeded.
5.4.2. Creating a Bugzilla
user for the replicator
You need to create a Bugzilla user for the replicator. The replicator uses
e-mail addresses to work out which Perforce user corresponds to which Bugzilla
user. A Perforce user that does not correspond to a Bugzilla user is translated
to the replicator's Bugzilla user, except for user fields (for example,
"AssignedTo") in jobs. The replicator rejects a change when there is no
Bugzilla user corresponding to a changed user field.
To create a Bugzilla user for the replicator, follow these steps:
-
In a Web browser, go to <http://your-bugzilla-path/editusers.cgi>.
-
Log in if prompted.
-
Click Submit to display the user list.
-
At the bottom of the user list, click "Add a new user".
-
In the "Login name" field, enter the replicator
e-mail address (replicator_address).
-
In the "Real name" field, enter a name like "Perforce defect tracking integration".
-
Enter a password.
-
In the "Disable text" field, enter something like "This user can access
Bugzilla only as the P4DTI
replicator process" to prevent access through the Bugzilla user interface.
-
Click Add to create the user.
5.4.3. Enabling the P4DTI
extensions in Bugzilla
After patching the Bugzilla code, you need to enable the
P4DTI
extensions in Bugzilla. There are two extensions:
Bugzilla's bug form includes information about the corresponding job
in Perforce, and a table of fixes.
Bugzilla saves its configuration parameters in its database, making
it possible for the P4DTI
to support the "emailsuffix" feature.
To enable the extensions, follow these steps:
-
In a Web browser, go to <http://your-bugzilla-path/editparams.cgi>.
-
Log in as the Bugzilla administrator if prompted.
-
Set the "p4dti" parameter to "on" (if it is not already on).
-
Click "Submit changes" to enable the extensions.
To disable use of the
P4DTI
from the Bugzilla user interface, set the "p4dti" parameter to "off".
5.5. Starting and stopping the
replicator manually
To start the replicator, follow these steps from the operating system command
line:
-
Go to the P4DTI
installation directory.
-
Run the command python run.py.
The first time you start the replicator, it displays log output explaining
how the replicator is setting up the defect tracker schema extensions,
as shown in the following figure:
Figure 10. Example replicator
log output on startup (TeamTrack integration)
2001-03-12 20:05:45 UTC (P4DTI-6018) Installing field 'P4DTI_RID' in the TS_CASES table.
2001-03-12 20:05:45 UTC (P4DTI-6018) Installing field 'P4DTI_SID' in the TS_CASES table.
2001-03-12 20:05:45 UTC (P4DTI-6018) Installing field 'P4DTI_JOBNAME' in the TS_CASES table.
2001-03-12 20:05:46 UTC (P4DTI-603X) Installed all new fields in the TS_CASES table.
2001-03-12 20:05:47 UTC (P4DTI-6040) Put 'LAST_CHANGE' parameter in replicator configuration with value '0'.
2001-03-12 20:05:47 UTC (P4DTI-6040) Put 'SERVER' parameter in replicator configuration with value '"{'sid': 'perforce0', 'description': 'Perforce server on sandpiper'}"'.
2001-03-12 20:05:47 UTC (P4DTI-6040) Put 'STATUS_VALUES' parameter in replicator configuration with value '"{'sid': 'perforce0', 'description': '_new/assigned/closed/verified/deferred'}"'.
2001-03-12 20:05:47 UTC (P4DTI-6040) Put 'CHANGELIST_URL' parameter in replicator configuration with value '"{'sid': 'perforce0', 'description': 'http://sandpiper.ravenbrook.com:8080/%d?ac=10'}"'.
2001-03-12 20:05:48 UTC (P4DTI-8002) Mailing 'P4DTI administrator <gdr+admin@ravenbrook.com>' re: '(P4DTI-8669) The P4DTI replicator has started.'.
...
|
Each log entry consists of the date of the entry, a message identifier,
and the message text. You can use the message identifier of an error message
to look it up in section 11.2, "Error messages
by identifier".
During its startup sequence, the replicator creates Perforce jobs corresponding
to every defect tracker issue created or modified after the (start_date).
It then polls for changes every poll_period
seconds and replicates those changes. Figure 11
shows typical replicator log output when it is replicating a change.
Figure 11. Example replicator
log output on replication (TeamTrack integration)
2001-03-12 19:59:29 UTC (P4DTI-8057) Replicating job 'CHG00003' to issue 'CHG00003'.
2001-03-12 19:59:30 UTC (P4DTI-824X) -- Changed fields: {'SEVERITY': 46, 'VERSION': 53, 'STATE': 2, 'PRIORITY': 17}.
2001-03-12 19:59:30 UTC (P4DTI-6007) -- Transition: 3; User: rb.
2001-03-12 19:59:30 UTC (P4DTI-8261) -- Defect tracker made changes as a result of the update: {'Owner': 'gdr'}.
|
To stop the replicator on Windows, follow these steps:
-
Select the command window in which the replicator is running.
-
Press Control-C and wait for the replicator to next poll (this takes up
to poll_period seconds).
To stop the replicator on Unix systems, kill the replicator process. If
it's running in a shell, bring it to the foreground and type Control-C.
If not, find out the process id of the replicator process and run the command
kill -TERM
replicator-process-id.
5.6. Setting up the replicator
to start automatically
The P4DTI
can be run as a daemon on Unix and as an NT service on Windows. Check that
the replicator starts manually and runs correctly,
before leaving it to run automatically.
5.6.1. Running automatically
on Unix
If you installed the P4DTI
using the Linux RPM as
described in section 4.3, "Linux installation",
a startup script is automatically created in /etc/rc.d/init.d
directory, so that the replicator starts as a daemon when the machine is
booted. Alternatively you can start the P4DTI
daemon manually by calling the startup script yourself:
/etc/rc.d/init.d/p4dti start
The replicator halts automatically when the system is shut down. You can
stop the replicator daemon manually using the stop script:
/etc/rc.d/init.d/p4dti stop
On Solaris or other Unixes (and on Linux if you did not use the RPM
installer), you might want to adapt the Linux startup script. It is in
the file named startup-script in the installation directory.
5.6.2. Running automatically
on Windows
On Windows, you can choose to install the P4DTI
as a service. The replicator then starts when the machine is booted. You
need not be logged on to the machine for the service to run or to stay
running.
To install the service, follow these steps from the operating system
command line:
-
Go to the P4DTI
installation directory.
-
Run the command:
python service.py
Once the service has been installed, it can be started in any of the following
ways:
-
Use the control panel to start the Services applet and scroll down until
you find "P4DTI". Click on this once, then click "Start".
-
Go to the P4DTI
installation directory and run the command: python service.py start.
-
When the machine reboots, the service starts automatically.
Once the service is running, it can be halted in any of the following ways.
Note that you need not halt the service the same way that you started it.
-
Use the control panel to start the Services applet and scroll down until
you find "P4DTI". Click on this once, then click "Stop".
-
Go to the P4DTI
installation directory and run the command: python service.py stop.
-
When the machine is shut down, the service stops automatically.
To uninstall the service, go to the P4DTI
installation directory and run the command:
python service.py remove
5.7. Advanced configuration
Not all of the flexibility of the P4DTI
is available using the configuration options described in this section.
Advanced configuration of the P4DTI
is possible, but beyond the scope of this manual. Here are some of the
things that are possible with advanced configuration:
-
Connecting a defect tracker to multiple Perforce servers.
-
Working with an existing Perforce jobs database and an existing Perforce
jobspec.
-
Fine control over which defect tracker issues are replicated to Perforce.
-
Fine control over which issue fields are replicated, and their names.
-
Arbitrary translation of issue data between the defect tracker and Perforce.
-
Queries based on combined defect tracker and Perforce data.
-
Working with locally customized versions of Bugzilla.
-
Redirection or fine control of logging.
-
Arbitrary mappings between Perforce and defect tracker user names.
-
Alternative policies for handling conflicts between defect tracker and
Perforce changes to issues.
Contact Perforce
technical support if you need any of these facilities.
6. Migrating your defect tracking
data to the integrated system
6.1. Migrating from the defect
tracker
You do not need to take any special action to migrate defect tracking data
from your defect tracker to the integrated system. The replicator starts
replicating defect tracker issues as soon as it starts up. Only issues
that are created or modified after the start_date
are replicated to Perforce.
6.2. Allowing users to create
issues in Perforce
See section 3, "Allowing users to
create issues in Perforce" in the Perforce
Defect Tracking Advanced Administrator's Guide.
6.3. Migrating to the defect
tracker from Perforce jobs
See section 4, "Migrating to the
defect tracker from Perforce jobs" in the Perforce
Defect Tracking Advanced Administrator's Guide.
7. Testing the P4DTI
7.1. Taking a single step
When you're testing your P4DTI
configuration, you might need to tell theP4DTI
take a single step; that is, to poll the defect tracker and Perforce for
changes, replicate those changes, then stop. If you need to do this:
-
Change to the P4DTI
installation directory.
-
Run the command python poll.py.
7.2. Testing your configuration
Test the P4DTI
configuration by creating a test issue and taking it through a complete
life-cycle (that is, through the workflow) as described in the Perforce
Defect Tracking Integration User's Guide. You might need to adapt
the use cases described in the user's guide to your organization's workflow.
Test the P4DTI
from both Perforce and the defect tracker. In Perforce, test the P4DTI
using the interface that your developers are most likely to use. The main
Perforce interfaces are:
-
P4, the Perforce command line.
-
P4Win, the Perforce GUI.
-
The Perforce IDE integrations, if you use them.
7.3. Checking data consistency
To run the consistency checker and manage its output, follow these steps:
-
Change to the P4DTI
installation directory.
-
Run the command python check.py.
You can also examine the database using a database application (for example,
Microsoft Access or the mysql command) to ensure the Perforce
data is in there.
8. Training and documentation
You might want to provide training for Perforce and defect tracker users
before they adopt the P4DTI
for everyday use. If so, consider preparing training materials that walk
them through the workflow for an issue, using the procedures that are documented
in the Perforce Defect Tracking Integration
User's Guide.
Even if you don't have a formal training session for your users, ensure
that they:
9. Maintaining the P4DTI
9.1. Maintaining the configuration
You must stop and restart the replicator as described in section
5.5, "Starting the replicator manually" after changing any of the configuration
parameters described in section 5.1, "P4DTI
configuration".
You must also refresh Perforce jobs, as described in section
9.2, "Refreshing jobs in Perforce", after changing either:
-
the list of replicated fields (replicated_fields for Bugzilla
or TeamTrack), or
-
the start date for replication (start_date).
Perforce uses the field number in the jobspec to find data, not the field
name (for more information, see the Perforce
System Administrator's Guide). If you change the list of replicated
fields, then the field numbers change, which means that the fields of existing
jobs in Perforce will be mixed up. Refreshing the jobs re-creates them
from the defect tracker with the correct fields.
9.2. Refreshing jobs in Perforce
Refreshing jobs updates all jobs in Perforce by replicating them from the
defect tracker's database. This procedure is necessary if:
-
The Perforce jobs become corrupted.
-
You change the set of replicated fields in the replicator's configuration.
For details, see section 9.1, "Maintaining the configuration".
-
You change the start date of replication in the replicator's configuration.
For details, see section 9.1.
To refresh the Perforce jobs, follow these steps from the operating system
command line:
-
Stop the replicator.
-
Go to the P4DTI
installation directory.
-
Run the command python refresh.py.
-
Start the replicator again by running the command python run.py.
10. Uninstalling the P4DTI
To uninstall the P4DTI,
follow these steps:
-
Tell your staff. Ask them to stop using either Perforce jobs or the defect
tracking, whichever you're not planning to use in future.
-
Stop the replicator by following the instructions in section
5.5, "Starting the replicator manually" (or section
5.6, "Setting up the replicator to start automatically").
-
Remove any hooks that you created in section 5.6,
"Setting up the replicator to start automatically", such as Windows
services, entries in /etc/rc.d, and so on.
-
If you're using Bugzilla:
-
Disable the Bugzilla extensions that were enabled in section
5.4.3, "Enabling the Bugzilla extensions".
-
Delete the replicator's Bugzilla user that was created in section
5.4.2, "Creating a Bugzilla user for the replicator".
-
optionally, restore the unpatched copy of Bugzilla made in section
5.4.1, "Patching Bugzilla".
-
If you're using TeamTrack:
-
Delete the replicator's TeamTrack user that was created in section
5.3.2, "Creating a TeamTrack user for the replicator".
-
Remove any Perforce triggers that were added in section
5.2.2, "Installing Perforce triggers to enforce workflow".
-
Delete the replicator's Perforce user created in section
5.2.1, "Creating a Perforce user for the replicator".
-
If you installed using the Linux RPM,
as described in section 4.3, "Linux installation",
uninstall using the command
rpm -e p4dti
Otherwise, delete the contents of the P4DTI
installation directory.
11. Troubleshooting and error
messages
11.1. Troubleshooting
To troubleshoot a problem with the P4DTI,
follow these steps:
Look in the P4DTI
log. If you find an error message, see if it is listed in section
11.2, "Error messages".
Check your configuration against section 5.1,
"P4DTI configuration".
Are the hostnames, userids, and passwords correct? Most problems with the P4DTI
are caused by incorrect or inconsistent configuration.
See if there is any online support for your problem. Visit the P4DTI
issue reports page <http://www.ravenbrook.com/project/p4dti/issue/>,
choose your release and select the "Support information" report.
If you can't solve the problem, contact Perforce support (for details,
see <http://www.perforce.com/perforce/support.html>).
Provide the following information:
-
What you did immediately prior to the error's occurrence.
-
What you think should have happened.
-
What actually happened.
-
The P4DTI
release you are using (look in the readme.txt that came with your P4DTI
distribution to identify the release).
-
The Perforce release you are using. To determine your Perforce release,
enter "p4 info" at the operating system command line.
-
The name and release of the defect tracker you are using. To determine
your TeamTrack release, click the information symbol in the top right of
the page; include the Version, Browser, Web Server and Database entries
in your problem report. To determine your Bugzilla release, check the top
of a bug form.
-
A section of the P4DTI
log that includes the error that you're reporting and some context around
that error.
-
Copies of any related e-mail messages generated by the P4DTI.
-
A copy of your config.py file.
11.2. Error messages by identifier
This isn't a complete list, but it covers the errors that have been seen
in testing, or which are reasonably likely to come up, or which need some
explanation. If you see a message not covered in this section or section
11.3, "Other error messages" and which is not self-explanatory, please
contact Perforce support (see section 11.1, "Troubleshooting").
(P4DTI-1058) Given
'%s' when expecting a string or integer.
(P4DTI-1069) Select
'%s' of %s returns no rows.
(P4DTI-107X) Select
'%s' of %s expecting one row but returns %d.
(P4DTI-1080) Trying
to fetch a row from non-select '%s'.
(P4DTI-1091) Select
'%s' of %s returned an unfetchable row.
(P4DTI-1105) Trying
to fetch rows from non-select '%s'.
(P4DTI-1116) Select
'%s' of %s returned unfetchable rows.
(P4DTI-1127) Select
'%s' of %s expecting no more than one row but returns %d.
(P4DTI-1138) Select
'%s' of %s returns %d columns but %d values.
(P4DTI-1160) Couldn't
insert row in table '%s'.
(P4DTI-1171) Couldn't
update row in table '%s' where %s.
(P4DTI-1229) Nothing
in p4dti_replications table: database corrupted?
(P4DTI-1273) Bugzilla's
fielddefs table does not include '%s'.
The replicator has had an unexpected difficulty in accessing the Bugzilla
database. Possibly there is a problem with MySQL or MySQLdb. Possibly you
are running a version of Bugzilla which is incompatible with the P4DTI,
or have customized Bugzilla in such a way that the P4DTI
has become confused. Please contact Perforce support (see section
11.1, "Troubleshooting").
(P4DTI-1207) Unknown
or future P4DTI/Bugzilla schema version %s detected.
It looks as though you've been running with a later release of the P4DTI
and then downgraded to an older release. We don't support downgrading;
use the most recent release.
(P4DTI-123X) Bugzilla
version %s is not supported by the P4DTI.
The P4DTI
doesn't support your version of Bugzilla. Upgrade to a supported release
(see section 3.4.1).
(P4DTI-2006) Configuration
parameter '%s' must be 0 or 1.
(P4DTI-2017) Configuration
parameter '%s' (value '%s') is not a valid date. The right format is 'YYYY-MM-DD
HH:MM:SS'.
(P4DTI-2028) Configuration
parameter '%s' (value '%s') is not a valid e-mail address.
(P4DTI-2039) Configuration
parameter '%s' must be a function.
(P4DTI-204X) Configuration
parameter '%s' must be an integer.
(P4DTI-2050) Configuration
parameter '%s' must be a list.
(P4DTI-2061) Configuration
parameter '%s' must be a list of %s.
(P4DTI-2072) Configuration
parameter '%s' must be a string.
(P4DTI-2083) Configuration
parameter '%s' must be None or a string.
(P4DTI-2094) Configuration
parameter '%s' (value '%s') must be from 1 to 32 characters long, start
with a letter or number, and consist of letters, numbers and underscores
only.
(P4DTI-2108) Configuration
parameter '%s' (value '%s') must contain exactly one %%d format specifier,
any number of doubled percents, but no other format specifiers.
(P4DTI-2119) Configuration
parameter '%s' (value '%s') must contain exactly one %%s format specifier,
any number of doubled percents, but no other format specifiers.
Preliminary checking of the parameters set in config.py has found
a problem. Correct the named parameter and start the P4DTI
again.
(P4DTI-3009) Two
Bugzilla states '%s' and '%s' map to the same Perforce state '%s'.
You are running a version of Bugzilla with different bug statuses from
those in Bugzilla 2.10, 2.12, 2.14, or 2.14.1. The P4DTI
has attempted to choose a sensible translation of these bug statuses to
Perforce job states, but has failed. You may be able to fix this by changing
the closed_state parameter.
Otherwise you must modify your Bugzilla configuration.
The P4DTI
chooses the names of states of Perforce jobs based on the status names
in Bugzilla. It uses the following translation system:
-
To avoid user confusion in the Perforce interface, the P4DTI
translates all state names to lower case.
-
Perforce job states can't contain spaces and various other characters,
so the P4DTI
translates spaces to underscores, and translates other special characters.
-
If the closed_state
parameter is not None, the P4DTI
translates this status to "closed" and translates "CLOSED" to "bugzilla_closed".
-
Perforce jobs can't have the state "new" or "ignore", because these states
have special meaning to the Perforce server. The P4DTI
prefixes a Bugzilla status which would translate to either of these with
"bugzilla_", so (in particular) "NEW" translates to Perforce state "bugzilla_new".
For instance, if the closed_state
parameter is "RESOLVED", the P4DTI
uses the following translation table for the default Bugzilla statuses:
| Bugzilla status |
Perforce state |
| UNCONFIRMED |
unconfirmed |
| NEW |
bugzilla_new |
| ASSIGNED |
assigned |
| RESOLVED |
closed |
| VERIFIED |
verified |
| CLOSED |
bugzilla_closed |
| REOPENED |
reopened |
Alternatively, if the closed_state
parameter is "CLOSED" or None, theP4DTI
uses the following translation table for the default Bugzilla statuses:
| Bugzilla status |
Perforce state |
| UNCONFIRMED |
unconfirmed |
| NEW |
bugzilla_new |
| ASSIGNED |
assigned |
| RESOLVED |
resolved |
| VERIFIED |
verified |
| CLOSED |
closed |
| REOPENED |
reopened |
(P4DTI-301X) You
specified the closed_state '%s', but there's no such Bugzilla state.
Check the closed_state
parameter. It must be a valid Bugzilla state.
(P4DTI-3020) The
'%s' column of Bugzilla's 'bugs' table is not an enum type.
The P4DTI
is incompatible with the version of Bugzilla which you are running. You
are running a very old version of Bugzilla, or have customized Bugzilla.
(P4DTI-3031) Configuration
parameter 'bugzilla_directory' does not name a directory.
(P4DTI-3042) Configuration
parameter 'bugzilla_directory' does not name a directory containing a processmail
script.
Check the bugzilla_directory
parameter. It must either be None or a string naming the Bugzilla
installation directory.
(P4DTI-3053) Bugzilla's
table 'profiles' does not have a 'login_name' column.
(P4DTI-3064) The
'login_name' column of Bugzilla's 'profiles' table does not have a 'text'
type.
(P4DTI-3075) Bugzilla's
table 'bugs' does not have a '%s' column.
(P4DTI-3086) The
'bug_status' column of Bugzilla's 'bugs' table is not an enum type.
(P4DTI-3097) The
'resolution' column of Bugzilla's 'bugs' table is not an enum type.
(P4DTI-3100) The
'resolution' column of Bugzilla's 'bugs' table does not have a 'FIXED'
value.
The P4DTI
is incompatible with the version of Bugzilla which you are running. You
are running a very old version of Bugzilla, or have customized Bugzilla.
(P4DTI-3111) Field
'%s' specified in 'replicated_fields' is a system field: leave it out!
Some fields are always replicated. For details, see the replicated_fields
parameter.
Remove the system fields from your list of replicated fields and start
the P4DTI
again.
(P4DTI-3122) Field
'%s' appears twice in 'replicated_fields'.
Each replicated field must only appear once in the replicated_fields
parameter. Remove the duplicate and start the P4DTI
again.
(P4DTI-3133) Field
'%s' specified in 'replicated_fields' list not in Bugzilla 'bugs' table.
The replicated_fields
parameter specifies a field which is not in Bugzilla.
(P4DTI-3144) Field
'%s' specified in 'replicated_fields' list has type '%s': this is not yet
supported by P4DTI.
(P4DTI-3155) Field
'%s' specified in 'replicated_fields' list has floating-point type: this
is not yet supported by P4DTI.
The P4DTI
doesn't support all Bugzilla field types. One of the fields in your replicated_fields
parameter has an unsupported type.
Remove the field from your replicated_fields
and start the replicator again.
If you really need this field to be replicated, see the advice for (P4DTI-4067).
(P4DTI-3166) You
can't have a field called 'code' in the Perforce jobspec.
You are running a version of Bugzilla with different bug fields from those
in Bugzilla 2.10, 2.12, 2.14, or 2.14.1, and are trying to replicate a
field called "code". Perforce doesn't allow a job field called "code".
Remove the "code" field from the replicated_fields
parameter or modify your Bugzilla configuration to rename the field.
(P4DTI-3177) Too
many fields to replicate: Perforce jobs can contain only 99 fields.
Reduce the number of fields that you replicate by removing items from the
replicated_fields
parameter.
(P4DTI-4001) Two
TeamTrack states '%s' and '%s' map to the same Perforce state '%s'.
The P4DTI
chooses the names of states of Perforce jobs based on the state names in
TeamTrack. It uses the following mapping system:
-
Perforce job states can't contain spaces and various other characters,
so the P4DTI
maps spaces to underscores, and translates other special characters.
-
To avoid user confusion in the Perforce interface, the P4DTI
maps all state names to lower case, which means that you can't have defect
tracker states which are only distinguished by differences in case. (But
note that in TeamTrack, which has different issue workflows for different
projects, it's OK to have states with the same name as long as they are
in different projects.)
-
Perforce jobs can't have the state "new" or "ignore", because these states
have special meaning to the Perforce server. The P4DTI
maps a defect tracker state "new" (or "New", "NEW", and so on) to Perforce
state "_new" and a defect tracker state "ignore" to Perforce state "_ignore".
This mapping system means that you also can't have states called " new"
or " ignore" with an initial space (or " New", " Ignore", and so on) in
the defect tracker at the same time as one called "new" or "ignore".
Resolve t