turbot/bitbucket

steampipe plugin install bitbucketsteampipe plugin install bitbucket

Table: bitbucket_branch_restriction

Bitbucket branch restrictions allow you to control the actions users can perform on a single branch, branch type, or branch pattern within a repository. Branch restrictions provide another level of security within Bitbucket Server, along with user authentication and project, repository and global permissions, that together allow you to control, or enforce, your own workflow or process.

The bitbucket_branch_restriction table can be used to query issues belonging to a repository, and you must specify which repository with where repository_full_name='workspace/repository'. Also you must have admin access to the repository in order to access the branch restrictions.

Examples

List the branch restrictions in a repository

select
repository_full_name,
id,
self_link,
kind,
value,
type
from
bitbucket_branch_restriction
where
repository_full_name = 'sayan97tb/stmp-rep';

List the branch restrictions having pattern for branch names

select
repository_full_name,
id,
self_link,
pattern
from
bitbucket_branch_restriction
where
repository_full_name = 'sayan97tb/stmp-rep'
and pattern = 'test-*';

List the branch restrictions associated with a specific user

select
repository_full_name,
id,
self_link,
pattern,
u ->> 'display_name' as user_name
from
bitbucket_branch_restriction,
jsonb_array_elements(users) as u
where
repository_full_name = 'sayan97tb/stmp-rep'
and u ->> 'display_name' = 'sayan';

List the branch restrictions having 'branching_model' branch_match_kind

select
repository_full_name,
id,
self_link,
pattern,
branch_match_kind
from
bitbucket_branch_restriction
where
repository_full_name = 'sayan97tb/stmp-rep'
and branch_match_kind = 'branching_model';

.inspect bitbucket_branch_restriction

Branch restrictions allow you to control the actions users can perform on a single branch, branch type, or branch pattern within a repository.

NameTypeDescription
branch_match_kindtextThe Branch match kind for the branch restriction.
branch_typetextThe type of branch selected while creating the branch restriction.
groupsjsonbDetails of the groups associated with the branch restriction.
idbigintThe unique ID if the branch restriction.
kindtextThe type of restriction achieved using the branch restriction.
patterntextThe branch name pattern specified while creating the branch restriction.
repository_full_nametextThe repository's full name.
self_linktextThe URL to the branch restriction.
titletextTitle of the resource.
typetextThe type of the branch operation.
usersjsonbDetails of the users associated with the branch restriction.
valuebigintThe value associated to the kind for the branch restriction.