Clearquest Daemon

Overview

At a previous company I was asked to provide a mechanism for controlled checkins of code into release branches. It was decided not to use Rational's UCM Model since the company was small and it's needs were simple. Additionally the company wanted to be able to produce Release Notes depicting which bugs were fixed in the release in an automated fashion. They did not want to incur significant overhead when checking in code and wanted to tightly control which bugs went into which release branch.

Problem Statement: Provide a mechanism for controlled checkins and a way to automate Release Notes for releases.

Environment

The environment of this company was as follows:

Multisite and the Shanhai office were not initially rolled out but the design considered them nonetheless. Unfortunately Multisiting of the Clearquest database was ruled out as too expensive for our little startup company.

Requirements

The requirements for this Clearcase/Clearquest integration were as follows:

Assumptions

There were certain assumptions and other processes already put into place that assisted in the solution.

Check In Trigger

A better method was needed...

Daemon

CQPerl Problems

A good daemon process:

Since, at the time, CQPerl was the only supported way to interface with Clearquest it had to be used. Because CQPerl is based off of ActiveState Perl a number of problems arose:

  1. ActiveState Perl does not support calling setsid which is required to enter Daemon mode.
  2. ActiveState Perl does not reliably handle signals. This mean that the parent process could not reliably catch SIGCLD deaths

As a result the Clearquest Daemon Process is not multithreaded. Since the company is small and requests relatively infrequent this was an acceptable limitation. Still when processing large lists of Release Notes and over the WAN the service would, at times, be unavailable.

SetSID

The question remained then, How does one go into daemon mode?

Here I resorted to using something that the company was already using - Cygwin.

Cygwin is a Linux emulation running under Windows. It is one of the most complete emulations I have found. We used it to build (gnumake) as well as many other things.

Cygwin has a program called cygrunsrv which allows you to daemonize any other process.

Multithreading

The problem with making the server multithreaded was harder to resolve. Code was written to perform multithreading but the unreliability of signal handling proved to be a problem that could not be easily overcome.

Options for a multithreading included:

In the end it was decided since the demand on the server would not be that great, that a single threaded server would suffice.

Client/Server

In depth: Code listings for CQD Daemon, CQC Client and cqc.pm

Since this is a client server application the CQD Daemon was written as well as a CQC Client. A Perl module named cqc.pm was made to define the API for CDQ.

The test client, CQC, ended up being a useful command line tool to get information about a bug from Clearquest. A user could, for example, obtain the owner of a bug by simply doing:

    $ cqc 1234 owner
    swang
    $ cqc 1322 owner headline
    owner: jliu
    headline: Unable to modify ACLS that are created (observed during ACL tests)
    $
  

Trigger

In depth: Code listing for Check in Trigger.

A preop Checkin Trigger was created to:

A postop Checkin Trigger would then create labels for the bug IDs and apply those labels to the checked in elements.

Release Notes

In depth: Code listing for Releasenote CGI Script.

With the Clearquest Daemon satisifying requests and with the Checkin Trigger already relying on a flat file of bug IDs for a release, generating a web page of release notes merely involved some ordinary formatting of a web page and a calling of the daemon to supply Clearquest information in a tabular format.

Additionally web pages were created to allow addition of bug IDs to the release list

Since CQD returns all fields in the defect record a web page showing all details of a defect was also developed

And example of Release notes is shown here.