GitLab

Using GitLab to create study groups and projects.

Study Tracker supports integration with GitLab cloud or Community Edition (aka. Omnibus) via its REST API. Once configured, users can choose to create Git repositories to be linked to their studies, so that computational workflows and source code can be captured.

Preparing GitLab for Study Tracker Integration

Study Tracker will use a single GitLab project for creating study repositories. A single sub-group will be created for each Study Tracker program, under which projects (aka. Git repositories) will be created for both studies and assays. It is best that you start fresh with an empty group and use it exclusively for Study Tracker-created repositories.

Create a new Group in GitLab.

This needs to be done by an administrator. Give your project a clear name. Be thoughtful about how you set the Visibility Level of the group. For private GitLab instances, to ensure that projects are accessible to colleagues who do not have GitLab licenses, you should set the Visibility Level of the group 'Public'. For hosting on GitLab cloud, it is probably not wise to make your study projects available to the public internet.

Once the group has been created, make a note of the 'Group ID' that is displayed on the summary page.

Create an Access Token

Once the group has been created, you need to allow Study Tracker to access it using the GitLab API. The simplest way to do this is with a Group Access Token, which can be created in the group settings menu by someone with the appropriate privileges. The access token should be granted the 'Maintainer' role and 'api' scope, allowing it to create and access subgroups and projects.

It is possible to configure GitLab-Study Tracker integration with user credentials, but this violates the Principle of Least Privilege, as it grants Study Tracker potential control of the account being used and the ability to modify groups and projects outside the Study Tracker scope.

The created access token can be used to authorize API requests, without the need to authenticate a user. This is done by passing it in the Authorization header with the Bearer prefix (eg. Authorization: Bearer abcd-122324i534i). Be sure to save this token in a safe place.

Configuring Study Tracker

Once you have configured your GitLab group and generated an access token, you can configure the integration within Study Tracker. If you followed the steps described above, you can add the following parameters to your application.properties file:

git.mode=gitlab
gitlab.url=https://gitlab.mydomain.com
gitlab.root-group-id=123
gitlab.access-token=abcd-123456789

If you prefer to use user credentials to authenticate your GitLab requests, you will have to enable OAuth and configure an application for Study Tracker in your tenant. Once done, you can provide the Application ID and secret token with your user credentials to configure integration with Study Tracker:

git.mode=gitlab
gitlab.url=https://gitlab.mydomain.com
gitlab.root-group-id=123
gitlab.client-id=xxxxx
gitlab.client-secret=xxxxxx
gitlab.username=xxxxxx
gitlab.password=xxxxxx

Last updated