Contributing to Open Source

Open Source Software (OSS) is one of, if not the, power behind our Information Age, providing the foundation for our phones, appliances and most of the Internet. At TrialGrid we're no different, our product is built on Open Source libraries, using Open Source programming languages and run on Open Source operating systems.

In the last six months we have been able to build a product that would have taken previous generations hundreds of thousands of man hours. We're grateful and keen to give something back.

Greater Automation

If you've been reading this blog you know that one of our goals is to automate as much of our activities as possible. We have automated tests that are written once and run thousands of times; Our requirements are described as human readable executable tests so we can generate documents that demonstrate traceability between requirements and the tests that prove them (with screenshots).

We want to do the same for our release notes. Changes made to the product between one release and the next are tracked in our source code repository/bug tracking tool, GitLab. It's a waste of time to manually trawl through the records to compile a list of changes made for a particular release when we can have a software robot do it for us.

For this task we turned to the GitLab API and the python-gitlab library.

What we wanted to do was fairly simple. For a particular milestone (e.g. "Next Release") find all the Merge Requests (packages of code that were tested/reviewed and made part of the main product) and list all the comments and Issues (bugs/features) addressed in those requests.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gitlab

# private token authentication
gl = gitlab.Gitlab('https://our_gitlab_instance.com', 'OurSecretToken')
gl.auth()

# Get our project
project = gl.projects.get('TrialGrid/TrialGridProject')

# Get our milestone
milestone = project.milestones.get({'title':'Next Release'}

# Find all merge requests related to this milestone
merge_requests = milestone.merge_requests()

# Loop through the merge requests documenting the Issues addressed and code review evidence
for mr in merge_requests:

    for issue in mr.closes_issues():
        # Document the issues closed by this Merge request

    for note in mr.notes.list():
        # Document all the review comments as evidence of code review

Open Source Contribution

Unfortunately for us, even though it existed in the GitLab API, the milestone.merge_requests() method didn't exist in the python-gitlab API. GitLabs' APIs are expanding quickly, it is hard to keep up.

It took very little code to add this feature to the python-gitlab project and probably 20 minutes to update the documentation, run the tests and raise a request to incorporate this feature into the library.

Happily, our change was accepted into the product.

Now, we're under no illusion that we're changing the world with this tiny contribution. Other companies are doing much more (albeit with greater resources!). For example, Medidata has released a great deal of Open Source software under the very liberal MIT license (see https://github.com/mdsol). But at TrialGrid we're happy to be able to contribute back to the Open Source libraries we use.

Community

We see the same community attitude in the organizations that we are working with. When someone suggests a diagnostic or feature that they would like to see in TrialGrid our response is that we'll do it, for $0, so long as it is available to everyone. So far we've had no disagreement with that approach and it's a win for everyone: Our catalog of Diagnostics grows (now more than 60, with more on the way), the users get a better product and even greater reduction in effort and nobody pays a dime for the improvement.

Interested in finding out more? Contact us for more information.