steampipe plugin install theapsgroup/gitlab

Table: gitlab_merge_request

The gitlab_merge_request table can be used to query all merge requests in the GitLab instance.

Note: When used with the Public GitLab you must specify an = qualifier for at least one of the following fields.

  • reviewer_id
  • assignee_id
  • author_id
  • project_id

This is to prevent attempting to return ALL public merge requests which would result in an error.

Examples

List all merge requests

select
*
from
gitlab_merge_request;

List of merge requests for a specific project

select
*
from
gitlab_merge_request
where
project_id = 12345;

List of merge requests which have been merged in the last week

select
project_id,
title,
state,
target_branch,
source_branch,
merged_at,
merged_by_username
from
gitlab_merge_request
where
state = 'merged'
and merged_at >= (current_date - interval '7' day);

List all merge requests for your projects

select
p.name as project_name,
p.id as project_id,
m.id as mr_id,
m.title as mr_title,
m.state as mr_state,
m.assignee_username as mr_assignee
from
gitlab_my_project as p,
gitlab_merge_request as m

Schema for gitlab_merge_request

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
allow_collaborationbooleanIndicates if collaboration is allowed on the merge request.
approvals_before_mergebigintThe number of approvals required before merge can proceed.
assignee_idbigint=The ID of the assignee - link to `gitlab_user.id`.
assignee_nametextThe display name of the assignee.
assignee_usernametextThe username of the assignee - link to `gitlab_user.username`.
assigneesjsonbAn array of assigned usernames, for when more than one user is assigned.
author_idbigint=The ID of the author - link to `gitlab_user.id`.
author_nametextThe display name of the author.
author_usernametextThe username of the author - link to `gitlab_user.username`.
base_shatextThe base sha for the diff.
blocking_discussions_resolvedbooleanIndicates if blocking discussions have all been resolved.
can_mergebooleanIndicates if the current user can merge the merge request.
changes_counttextA count of changes contained within the merge request.
closed_attimestamp with time zoneTimestamp of when merge request was closed.
closed_by_idbigintThe ID of the user who closed the merge request - link to `gitlab_user.id`.
closed_by_nametextThe display name of the user who closed the merge request.
closed_by_usernametextThe username of the user who closed the merge request - link to `gitlab_user.username`.
created_attimestamp with time zoneTimestamp of merge request creation.
descriptiontextThe description of the merge request.
discussion_lockedbooleanIndicates if the merge request has the discussions locked against new input.
diverged_commits_countbigintA count of commits diverged from target_branch.
downvotesbigintCount of down-votes received on the issue.
draftbooleanIndicates if the merge request is a draft.
first_contributionbooleanIndicates if the merge request contains a first contribution to the project.
force_remove_source_branchbooleanIndicates if source_branch will be force deleted on merge.
full_reftextFull reference of the merge request.
has_conflictsbooleanIndicates if the merge request has conflicts with the target_branch.
head_shatextThe head sha for the diff.
idbigintThe global ID for the merge request.
iidbigint=The internal ID to the project for the merge request
labelsjsonbAn array of textual labels applied to the merge request.
merge_commit_shatextThe hash of the merge commit.
merge_errortextError message if the merge request can not be merged.
merge_statustextDescriptive status about the ability of being able to merge the merge request.
merge_when_pipeline_succeedsbooleanIndicates if the merge request will be merged upon completion of CI/CD pipeline.
merged_attimestamp with time zoneTimestamp of when merge request was merged.
merged_by_idbigintThe ID of the user who merged the merge request - link to `gitlab_user.id`.
merged_by_nametextThe display name of the user whom merged the merge request.
merged_by_usernametextThe username of the user who merged the merge request - link to `gitlab_user.username`.
milestone_created_attimestamp with time zoneTimestamp at which the milestone was created.
milestone_descriptiontextThe description of the milestone.
milestone_due_datetimestamp with time zoneTimestamp of due date for the milestone to be completed by.
milestone_expiredbooleanIndicates if the milestone is expired.
milestone_idbigintThe ID of the milestone the merge request is placed into.
milestone_iidbigintThe instance id of the milestone
milestone_start_datetimestamp with time zoneTimestamp of when the milestone was started.
milestone_statetextThe current state of the milestone.
milestone_titletextThe title of the milestone.
milestone_updated_attimestamp with time zoneTimestamp at which the milestone was updated.
pipeline_created_attimestamp with time zoneTimestamp when the pipeline was created.
pipeline_idbigintThe ID of the pipeline run against the merge request.
pipeline_project_idbigintThe ID of the project the pipeline run against the merge request belongs to.
pipeline_reftextThe reference of the pipeline.
pipeline_shatextThe commit sha that is run in the pipeline.
pipeline_sourcetextThe source of the pipeline.
pipeline_statustextThe status of the pipeline.
pipeline_updated_attimestamp with time zoneTimestamp when the pipeline was updated.
pipeline_urltextThe url of the pipeline.
project_idbigint=The ID of the project containing the merge request - link to `gitlab_project.ID`
rebase_in_progressbooleanIndicates if a rebase is in progress.
referencetextThe reference code of the merge request (example: `!4`).
rel_reftextRelative reference of the merge request.
reviewer_idbigint=Contains reviewer_id if passed as a qualifier for filtering, else null.
reviewersjsonbAn array of usernames who've been asked to review the merge request.
shatext
short_reftextShort reference of the merge request.
should_remove_source_branchbooleanIndicates if source_branch should be deleted on merge.
source_branchtextThe source branch of the merge request.
source_project_idbigintThe ID of the source project.
squashbooleanIndicates if a squash is requested.
squash_commit_shatextThe hash of the squashed merge commit.
start_shatextThe start sha for the diff.
statetextThe state of the merge request (open, closed, merged)
subscribedbooleanIndicates if the user associated to the token used to access the data is subscribed to the merge request.
target_branchtextThe target branch for the merge request.
target_project_idbigintThe ID of the target project.
titletextThe title of the merge request.
updated_attimestamp with time zoneTimestamp of last update to the issue.
upvotesbigintCount of up-votes received on the merge request.
user_notes_countbigintA count of user notes on the merge request.
web_urltextThe url to access the merge request.
work_in_progressbooleanIndicates if the merge request is a work in progress.