GitLab

The GitLab extractor pulls raw data from GitLab's REST API and extracts the following resources from GitLab:

For more information you can check the documentation for tap-gitlab.

GitLab Setup

In order to access your GitLab data, you will need the Private Token that GitLab extractor will use to connect to GitLab, the Groups and Projects you want to extract from and the Start Date you want the extracted data set to start from.

GitLab API Token

Full access to GitLab's API requires a personal access token that will authenticate you with the server. This is very simple to do:

  1. Navigate to your profile's access tokens.

  2. Fill out the personal access token form with the following properties:

  • Name: meltano-gitlab-tutorial
  • Expires: leave blank unless you have a specific reason to expire the token
  • Scopes:
    • api
  1. Click on Create personal access token to submit your request.

  2. You should see your token appear at the top of your screen.

  3. Copy and paste the token into the Private Token field. It should look something like this: I8vxHsiVAaDnAX3hA

Projects

This property allows you to scope the project that the service fetches, but it is completely optional. If this is left blank, the extractor will try to fetch all projects that it can grab.

If you want to configure this, the format for it is group/project. Here are a couple examples:

Groups

This property allows you to scope data that the extractor fetches to only the desired group(s). The group name can generally be found at the root of a repository's URL. If this is left blank, you have to at least provide a project.

For example, https://www.gitlab.com/meltano/tap-gitlab has a group of meltano. This can be confirmed as well by visiting https://gitlab.com/meltano and noting the Group ID below the header.

Group ID verification example

Configuration options for Groups and projects

  • Either groups or projects need to be provided
  • Filling in 'groups' but leaving 'projects' empty will sync all the projects for the provided group(s).
  • Filling in 'projects' but leaving 'groups' empty will sync the specified projects.
  • Filling in 'groups' and 'projects' will sync only the specified projects in those groups.

Start Date

This property allows you to configure where you want your data set to start from. Otherwise, if left blank, it will try to fetch the entire history of the groups or projects specified.

Meltano Setup

Prerequisites

Configure the Extractor

Open your Meltano instance and click "Pipelines" in the top navigation bar. You should now see the Extractors page, which contains various options for connecting your data sources.

Screenshot of Meltano UI with all extractors not installed and GitLab Extractor highlighted

Let's install tap-gitlab by clicking on the Install button inside its card.

On the configuration modal we want to enter the Private Token the GitLab extractor will use to connect to GitLab, the Groups and Projects we are going to extract from and the Start Date we want the extracted data set to start from.

Screenshot of GitLab Extractor Configuration

TIP

Ready to do more with data from GitLab?

Check out our GitLab API + Postgres tutorial to learn how you can create an analytics database from within Meltano, and start analyzing your GitLab data.

Advanced: Command Line Installation

  1. Navigate to your Meltano project in the terminal
  2. Run the following command:
meltano add extractor tap-gitlab

If you are successful, you should see Added and installed extractors 'tap-gitlab' in your terminal.

Configuration

  1. Open your project's .env file in a text editor
  2. Add the following variables to your file:

Required:

export GITLAB_API_TOKEN="private access token"
export GITLAB_API_GROUPS="myorg mygroup"
export GITLAB_API_PROJECTS="myorg/repo-a myorg/repo-b"
export GITLAB_API_START_DATE="YYYY-MM-DDTHH:MM:SSZ" # e.g. 2019-10-31T00:00:00Z

Optional:

export GITLAB_API_ULTIMATE_LICENSE="true"

If ultimate_license is true (defaults to false), then the GitLab account used has access to the GitLab Ultimate or GitLab.com Gold features. It will enable fetching Epics, Epic Issues and other entities available for GitLab Ultimate and GitLab.com Gold accounts.

Check the README for details.

Last Updated: 12/3/2019, 8:08:01 PM