In this section, we present how to connect GitLab repository to MindsDB. GitLab is a DevSecOps Platform. Data from GitLab, including issues and MRs, can be utilized within MindsDB to make relevant predictions or automate the issue/MR creation.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or use MindsDB Cloud.
  2. To connect GitLab to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to GitLab.

Connection

This handler was implemented using the python-gitlab library. python-gitlab is a Python library that wraps GitLab API.

The GitLab handler is initialized with the following parameters:

  • repository: a required name of a GitLab repository to connect to.
  • api_key: an optional GitLab API key to use for authentication.

Here is how to connect MindsDB to a GitLab repository:

CREATE DATABASE mindsdb_gitlab
WITH ENGINE = 'gitlab',
PARAMETERS = {
  "repository": "gitlab-org/gitlab",
  "api_key": "api_key",    -- optional GitLab API key
};

Usage

The mindsdb_gitlab connection contains two tables: issues and merge_requests.

Now, you can use this established connection to query this table as:

SELECT * FROM mindsdb_gitlab.issues;

You can run more advanced queries to fetch specific issues in a defined order:

SELECT number, state, creator, assignee, title, created, labels 
  FROM mindsdb_gitlab.issues
  WHERE state="opened"
  ORDER BY created ASC, creator DESC
  LIMIT 10;

And the same goes for merge requests:

SELECT number, state, creator, reviewers, title, created, has_conflicts
  FROM mindsdb_gitlab.merge_requests
  WHERE state="merged"
  ORDER BY created ASC, creator DESC
  LIMIT 10;

For more information about available actions and development plans, visit this page.