turbot/bitbucket
steampipe plugin install bitbucket

Table: bitbucket_branch - Query Bitbucket Branches using SQL

Bitbucket is a Git-based source code repository hosting service owned by Atlassian. Bitbucket branches represent independent lines of development within a repository. They allow developers to work on features or fixes without interfering with the main (or 'master') codebase, and can be merged back into the main codebase when the work is complete.

Table Usage Guide

The bitbucket_branch table provides insights into branches within Bitbucket. As a developer or DevOps engineer, explore branch-specific details through this table, including branch name, type, and associated commit. Utilize it to uncover information about branches, such as their current status, the associated commit, and the overall structure of development within a repository.

Important Notes

  • You must specify the repository_full_name in the where clause in order to query this table.
  • You must have admin access to the repository in order to access the branch restrictions.

Examples

List branches in a repository

Explore the branches within a specific repository to understand their default merge strategies and types. This can be useful for managing and optimizing your project's workflow within Bitbucket.

select
name,
repository_full_name,
default_merge_strategy,
type
from
bitbucket_branch
where
repository_full_name = 'souravthe/test1';
select
name,
repository_full_name,
default_merge_strategy,
type
from
bitbucket_branch
where
repository_full_name = 'souravthe/test1';

List branches with merge_commit default merge strategy

Explore which branches within a specific repository utilize the 'merge_commit' as their default merge strategy. This is useful for understanding the merging practices and strategies within your project.

select
name,
repository_full_name,
default_merge_strategy,
type
from
bitbucket_branch
where
repository_full_name = 'souravthe/test1'
and default_merge_strategy = 'merge_commit';
select
name,
repository_full_name,
default_merge_strategy,
type
from
bitbucket_branch
where
repository_full_name = 'souravthe/test1'
and default_merge_strategy = 'merge_commit';

Schema for bitbucket_branch

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
default_merge_strategytextBranch default merge strategy.
headsjsonbBranch head details.
linksjsonbBranch link details.
merge_strategiesjsonbBranch merge strategies.
nametext=The name of the branch.
repository_full_nametext=The repository full name.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
targetjsonbBranch target details.
titletextTitle of the resource.
typetextThe branch type.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- bitbucket

You can pass the configuration to the command with the --config argument:

steampipe_export_bitbucket --config '<your_config>' bitbucket_branch