Table: azuredevops_git_repository_branch - Query Azure DevOps Git Repositories using SQL
Azure DevOps is a service within Microsoft Azure that supports development teams in planning work, collaborating on code development, and deploying applications. Git Repositories in Azure DevOps provide version control and allow for collaborative code development. The branches within these repositories represent independent lines of development that can be created, merged, or deleted.
Table Usage Guide
The azuredevops_git_repository_branch
table provides insights into branches within Git Repositories in Azure DevOps. As a DevOps engineer, explore branch-specific details through this table, including the branch name, repository it belongs to, and its commit history. Utilize it to manage and track the development process across different branches, ensuring code integrity and efficient workflows.
Examples
Basic info
Analyze the settings to understand the status of different branches in your Azure DevOps Git repository. This would be useful to assess the progress of different projects or features by comparing the number of commits ahead or behind the base version.
select name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branch;
select name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branch;
List base version branches
Explore which branches serve as the base versions in your Azure DevOps Git repositories. This can help you understand the structure of your repositories and monitor the development progress in terms of commits ahead or behind the base version.
select name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branchwhere is_base_version;
select name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branchwhere is_base_version;
Get current commit details of main branch
Explore the most recent changes made to the main branch of your project. This can help you understand the nature of the changes, who made them, and their potential impact on the project.
select commit ->> 'commitId' as commit_id, commit ->> 'comment' as comment, commit -> 'committer' as committer, commit -> 'changeCounts' as change_counts, commit -> 'parents' as parentsfrom azuredevops_git_repository_branchwhere name = 'main';
select json_extract(commit, '$.commitId') as commit_id, json_extract(commit, '$.comment') as comment, commit as committer, commit as change_counts, commit as parentsfrom azuredevops_git_repository_branchwhere name = 'main';
List branches of a particular repository
Explore the different branches within a specific repository to gain insights into their respective ahead and behind counts, as well as their base version status. This can be particularly useful for managing and tracking changes in a complex development environment.
select b.name as branch_name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branch as b, azuredevops_git_repository as rwhere b.repository_id = r.id and r.name = 'test_repo';
select b.name as branch_name, repository_id, ahead_count, behind_count, is_base_versionfrom azuredevops_git_repository_branch as b, azuredevops_git_repository as rwhere b.repository_id = r.id and r.name = 'test_repo';
Schema for azuredevops_git_repository_branch
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
ahead_count | bigint | Number of commits ahead. | |
behind_count | bigint | Number of commits behind. | |
commit | jsonb | Current commit. | |
is_base_version | boolean | True if this is the result for the base version. | |
name | text | = | Name of the ref. |
organization | text | =, !=, ~~, ~~*, !~~, !~~* | The name of the organization. |
repository_id | text | = | The repository ID. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. |
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)" -- azuredevops
You can pass the configuration to the command with the --config
argument:
steampipe_export_azuredevops --config '<your_config>' azuredevops_git_repository_branch