gitlab_applicationgitlab_branchgitlab_commitgitlab_epicgitlab_groupgitlab_group_access_requestgitlab_group_hookgitlab_group_iterationgitlab_group_membergitlab_group_projectgitlab_group_push_rulegitlab_group_subgroupgitlab_group_variablegitlab_hookgitlab_instance_variablegitlab_issuegitlab_merge_requestgitlab_merge_request_changegitlab_my_eventgitlab_my_issuegitlab_my_projectgitlab_projectgitlab_project_access_requestgitlab_project_container_registrygitlab_project_deploymentgitlab_project_iterationgitlab_project_jobgitlab_project_membergitlab_project_pages_domaingitlab_project_pipelinegitlab_project_pipeline_detailgitlab_project_protected_branchgitlab_project_repositorygitlab_project_repository_filegitlab_project_variablegitlab_settinggitlab_snippetgitlab_usergitlab_user_eventgitlab_version
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_requestwhere 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_usernamefrom gitlab_merge_requestwhere 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_assigneefrom gitlab_my_project as p, gitlab_merge_request as m
Query examples
Schema for gitlab_merge_request
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
allow_collaboration | boolean | Indicates if collaboration is allowed on the merge request. | |
approvals_before_merge | bigint | The number of approvals required before merge can proceed. | |
assignee_id | bigint | = | The ID of the assignee - link to `gitlab_user.id`. |
assignee_name | text | The display name of the assignee. | |
assignee_username | text | The username of the assignee - link to `gitlab_user.username`. | |
assignees | jsonb | An array of assigned usernames, for when more than one user is assigned. | |
author_id | bigint | = | The ID of the author - link to `gitlab_user.id`. |
author_name | text | The display name of the author. | |
author_username | text | The username of the author - link to `gitlab_user.username`. | |
base_sha | text | The base sha for the diff. | |
blocking_discussions_resolved | boolean | Indicates if blocking discussions have all been resolved. | |
can_merge | boolean | Indicates if the current user can merge the merge request. | |
changes_count | text | A count of changes contained within the merge request. | |
closed_at | timestamp with time zone | Timestamp of when merge request was closed. | |
closed_by_id | bigint | The ID of the user who closed the merge request - link to `gitlab_user.id`. | |
closed_by_name | text | The display name of the user who closed the merge request. | |
closed_by_username | text | The username of the user who closed the merge request - link to `gitlab_user.username`. | |
created_at | timestamp with time zone | Timestamp of merge request creation. | |
description | text | The description of the merge request. | |
discussion_locked | boolean | Indicates if the merge request has the discussions locked against new input. | |
diverged_commits_count | bigint | A count of commits diverged from target_branch. | |
downvotes | bigint | Count of down-votes received on the issue. | |
draft | boolean | Indicates if the merge request is a draft. | |
first_contribution | boolean | Indicates if the merge request contains a first contribution to the project. | |
force_remove_source_branch | boolean | Indicates if source_branch will be force deleted on merge. | |
full_ref | text | Full reference of the merge request. | |
has_conflicts | boolean | Indicates if the merge request has conflicts with the target_branch. | |
head_sha | text | The head sha for the diff. | |
id | bigint | The global ID for the merge request. | |
iid | bigint | = | The internal ID to the project for the merge request |
labels | jsonb | An array of textual labels applied to the merge request. | |
merge_commit_sha | text | The hash of the merge commit. | |
merge_error | text | Error message if the merge request can not be merged. | |
merge_status | text | Descriptive status about the ability of being able to merge the merge request. | |
merge_when_pipeline_succeeds | boolean | Indicates if the merge request will be merged upon completion of CI/CD pipeline. | |
merged_at | timestamp with time zone | Timestamp of when merge request was merged. | |
merged_by_id | bigint | The ID of the user who merged the merge request - link to `gitlab_user.id`. | |
merged_by_name | text | The display name of the user whom merged the merge request. | |
merged_by_username | text | The username of the user who merged the merge request - link to `gitlab_user.username`. | |
milestone_created_at | timestamp with time zone | Timestamp at which the milestone was created. | |
milestone_description | text | The description of the milestone. | |
milestone_due_date | timestamp with time zone | Timestamp of due date for the milestone to be completed by. | |
milestone_expired | boolean | Indicates if the milestone is expired. | |
milestone_id | bigint | The ID of the milestone the merge request is placed into. | |
milestone_iid | bigint | The instance id of the milestone | |
milestone_start_date | timestamp with time zone | Timestamp of when the milestone was started. | |
milestone_state | text | The current state of the milestone. | |
milestone_title | text | The title of the milestone. | |
milestone_updated_at | timestamp with time zone | Timestamp at which the milestone was updated. | |
pipeline_created_at | timestamp with time zone | Timestamp when the pipeline was created. | |
pipeline_id | bigint | The ID of the pipeline run against the merge request. | |
pipeline_project_id | bigint | The ID of the project the pipeline run against the merge request belongs to. | |
pipeline_ref | text | The reference of the pipeline. | |
pipeline_sha | text | The commit sha that is run in the pipeline. | |
pipeline_source | text | The source of the pipeline. | |
pipeline_status | text | The status of the pipeline. | |
pipeline_updated_at | timestamp with time zone | Timestamp when the pipeline was updated. | |
pipeline_url | text | The url of the pipeline. | |
project_id | bigint | = | The ID of the project containing the merge request - link to `gitlab_project.ID` |
rebase_in_progress | boolean | Indicates if a rebase is in progress. | |
reference | text | The reference code of the merge request (example: `!4`). | |
rel_ref | text | Relative reference of the merge request. | |
reviewer_id | bigint | = | Contains reviewer_id if passed as a qualifier for filtering, else null. |
reviewers | jsonb | An array of usernames who've been asked to review the merge request. | |
sha | text | ||
short_ref | text | Short reference of the merge request. | |
should_remove_source_branch | boolean | Indicates if source_branch should be deleted on merge. | |
source_branch | text | The source branch of the merge request. | |
source_project_id | bigint | The ID of the source project. | |
squash | boolean | Indicates if a squash is requested. | |
squash_commit_sha | text | The hash of the squashed merge commit. | |
start_sha | text | The start sha for the diff. | |
state | text | The state of the merge request (open, closed, merged) | |
subscribed | boolean | Indicates if the user associated to the token used to access the data is subscribed to the merge request. | |
target_branch | text | The target branch for the merge request. | |
target_project_id | bigint | The ID of the target project. | |
title | text | The title of the merge request. | |
updated_at | timestamp with time zone | Timestamp of last update to the issue. | |
upvotes | bigint | Count of up-votes received on the merge request. | |
user_notes_count | bigint | A count of user notes on the merge request. | |
web_url | text | The url to access the merge request. | |
work_in_progress | boolean | Indicates if the merge request is a work in progress. |