Similar to the Source Control Management (SCM) integration plugin, the Azure DevOps integration plugin for Soundcheck provides out-of-box integration with Azure DevOps by leveraging Backstage’s Azure DevOps integration to implement collection of facts from Azure DevOps repositories. The purpose of the Azure DevOps integration plugin is to provide Azure DevOps-specific fact collection (like branch policies), while the SCM integration plugin provides the collection of facts based on repository content. The Azure DevOps integration plugin supports the collection of the following facts:Documentation Index
Fetch the complete documentation index at: https://backstage.spotify.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
- branch_policies
- branch_status
- number_of_branches
- number_of_active_pull_requests
- repository_details
- number_of_work_items
Prerequisites
Configure Azure DevOps integration in Backstage
Integrations are configured at the root level ofapp-config.yaml, here’s an example configuration for Azure DevOps:
Add the AzureDevOpsFactCollector to Soundcheck
First add the package:packages/backend/src/index.ts file:
packages/backend/src/index.ts
Entity configuration
To be able to determine the repository to use the Azure DevOps integration will use the value from thebackstage.io/source-location annotation. In many cases this will be set for you but if it is not you will need to add it to your catalog-info.yaml file, here’s a simple example:
Plugin Configuration
The collection of facts is driven by configuration. To learn more about the configuration, jump to the Defining Azure DevOps Fact Collectors.- Create
azure-facts-collectors.yamlin the root of your Backstage repository and fill in all your Azure DevOps fact collectors. A simple example Azure DevOps fact collector is listed below.
app-config.yaml files.
- Add a soundcheck collectors field to
app-config.yamland reference the newly createdazure-facts-collectors.yaml
Rate Limiting (Optional)
This fact collector can be rate limited in Soundcheck using the following configuration:Defining Azure DevOps Fact Collectors
This section describes the data shape and semantics of Azure DevOps Fact Collectors.Overall Shape Of Azure DevOps Fact Collector
The following is an example of a descriptor file for Azure DevOps Fact Collector:frequency [optional]
The frequency at which the collector should be executed. Possible values are either a cron expression { cron: ... } or HumanDuration.
This is the default frequency for each collector.
initialDelay [optional]
The amount of time that should pass before the first invocation happens. Possible values are either a cron expression { cron: ... } or HumanDuration.
Example:
batchSize [optional]
The number of entities to collect facts for at once. Optional, the default value is 1.
Note: Fact collection for a batch of entities is still considered as one hit towards the rate limits
by the Soundcheck Rate Limiting engine, while the actual number of hits
will be equal to the batchSize.
Example:
filter [optional]
A filter specifying which entities to collect the specified facts for. Matches the filter format used by the Catalog API.
This is the default filter for each collector.
See filters for more details.
exclude [optional]
Entities matching this filter will be skipped during the fact collection process. Can be used in combination with filter. Matches the filter format used by the Catalog API.
cache [optional]
If the collected facts should be cached, and if so for how long. Possible values are either true or false or a nested { duration: HumanDuration } field.
This is the default cache config for each collector.
collects [required]
An array describing which facts to collect and how to collect them. See below for details about the overall shape of a fact collector.
Overall Shape Of A Fact Collector
Each collector supports the fields described below.factName [optional]
The name of the fact to be collected (must be unique within Azure DevOps collector).
- Minimum length of 1
- Maximum length of 100
- Alphanumeric with single separator instances of periods, dashes, underscores, or forward slashes
type value (below).
type [required]
The type of the collector (e.g. branch_policies, repository_details).
frequency [optional]
The frequency at which the fact collection should be executed. Possible values are either a cron expression { cron: ... } or HumanDuration.
If provided it overrides the default frequency provided at the top level. If not provided it defaults to the frequency provided at the top level. If neither collector’s frequency nor default frequency is provided the fact will only be collected on demand.
Example:
batchSize [optional]
The number of entities to collect facts for at once. Optional, the default value is 1.
If provided it overrides the default batchSize provided at the top level. If not provided it defaults to the batchSize provided at the top level. If neither collector’s batchSize nor default batchSize is provided the fact will be collected for one entity at a time.
Note: Fact collection for a batch of entities is still considered as one hit towards the rate limits
by the Soundcheck Rate Limiting engine, while the actual number of hits
will be equal to the batchSize.
Example:
branch [optional]
The branch to collect the fact from. If not provided, defaults to the repository’s default branch.
filter [optional]
A filter specifying which entities to collect the specified facts for. Matches the filter format used by the Catalog API.
If provided it overrides the default filter provided at the top level. If not provided it defaults to the filter provided at the top level. If neither collector’s filter nor default filter is provided the fact will be collected for all entities.
exclude [optional]
Entities matching this filter will be skipped during the fact collection process. Can be used in combination with filter. Matches the filter format used by the Catalog API.
cache [optional]
If the collected facts should be cached, and if so for how long. Possible values are either true or false or a nested { duration: HumanDuration } field.
If provided it overrides the default cache config provided at the top level. If not provided it defaults to the cache config provided at the top level. If neither collector’s cache nor default cache config is provided the fact will not be cached.
Example:
Collecting Branch Policies Fact
Branch Policies fact contains information about configured branch policies for a given branch in Azure DevOps repository.Shape of A Branch Policies Fact Collector
The shape of a Branch Policies Fact Collector matches the Overall Shape Of Azure DevOps Fact Collector (restriction:type: branch_policies).
The following is an example of the Branch Policies Fact Collector config:
Shape of A Branch Policies Fact
The shape of a Branch Policies Fact is based on the Fact Schema. For a description of the data collected regarding branch policies, refer to the Azure DevOps API documentation. The following is an example of the collected Branch Policies Fact:Shape of A Branch Policies Fact Check
The shape of a Branch Policies Fact Check matches the Shape of a Fact Check. The following is an example of the Branch Policies fact checks:Collecting Branch Status Fact
Branch Status fact contains information about a status associated with the latest Git commit for a given branch in Azure DevOps repository.Shape of A Branch Status Fact Collector
The shape of a Branch Status Fact Collector matches the Overall Shape Of Azure DevOps Fact Collector (restriction:type: branch_status).
The following is an example of the Branch Status Fact Collector config:
Shape of A Branch Status Fact
The shape of a Branch Status Fact is based on the Fact Schema. For a description of the data collected regarding branch Status, refer to the Azure DevOps API documentation. The following is an example of the collected Branch Status Fact:Shape of A Branch Status Fact Check
The shape of a Branch Status Fact Check matches the Shape of a Fact Check. The following is an example of the Branch Status fact checks:Collecting Number of Branches Fact
Number of Branches fact contains a total number of branches in Azure DevOps repository or a number of branches with the last commit more than X days ago.Shape of A Number of Branches Fact Collector
The shape of a Number of Branches Fact Collector extends the Overall Shape Of Azure DevOps Fact Collector (restriction:type: number_of_branches).
Additional fields:
lastCommitMoreThanXDaysAgo [Optional]
A number of days to filter the branches by. If provided, the number of branches with the last commit older than this number of days will be collected.
If not provided, a total number of branches within a given repository will be collected.
The following is an example of the Number of Branches Fact Collector config:
Shape of A Number of Branches Fact
The shape of a Number of Branches Fact is based on the Fact Schema. The following is an example of the collected Number of Branches Fact:Shape of A Number of Branches Fact Check
The shape of a Number of Branches Fact Check matches the Shape of a Fact Check. The following is an example of the Number of Branches fact checks:Collecting Number of Active Pull Requests Fact
Number of Active Pull Requests fact contains a total number of active pull requests for a given target branch in Azure DevOps repository or a number of active pull requests created more than X days ago.Shape of A Number of Active Pull Requests Fact Collector
The shape of a Number of Active Pull Requests Fact Collector extends the Overall Shape Of Azure DevOps Fact Collector (restriction:type: number_of_active_pull_requests).
Additional fields:
createdMoreThanXDaysAgo [Optional]
A number of days to filter the pull requests by. If provided, the number of active pull requests created more than this number of days ago will be collected.
If not provided, a total number of active pull requests for a given target branch will be collected.
The following is an example of the Number of Active Pull Requests Fact Collector config:
Shape of A Number of Active Pull Requests Fact
The shape of a Number of Active Pull Requests Fact is based on the Fact Schema. The following is an example of the collected Number of Active Pull Requests Fact:Shape of A Number of Active Pull Requests Fact Check
The shape of a Number of Active Pull Requests Fact Check matches the Shape of a Fact Check. The following is an example of the Number of Active Pull Requests fact checks:Collecting Repository Details Fact
Repository Details fact contains information about Azure DevOps repository.Shape of A Repository Details Fact Collector
The shape of a Repository Details Fact Collector matches the Overall Shape Of Azure DevOps Fact Collector (restriction:type: repository_details).
The following is an example of the Repository Details Fact Collector config:
Shape of A Repository Details Fact
The shape of a Repository Details Fact is based on the Fact Schema. For a description of the data collected about repository, refer to the Azure DevOps API documentation. The following is an example of the collected Repository Details Fact:Shape of A Repository Details Fact Check
The shape of a Repository Details Fact Check matches the Shape of a Fact Check. The following is an example of the Repository Details fact checks:Collecting Number of Work Items Fact
Number of Work Items fact contains a total number of work items for a given project in Azure DevOps or a number of work items filtered by WIQL queries.Shape of A Number of Work Items Fact Collector
The shape of a Number of Work Items Fact Collector extends the Overall Shape Of Azure DevOps Fact Collector (restriction:type: number_of_work_items).
Additional fields:
data [Optional]
Defines the data to collect for this fact. This is an array consisting of two pairs of name and query:
name: An identifier for the data element.query: The WIQL syntax query to filter work items by.
data is not provided, the total number of work items will be collected as count: <X>.
The following is an example of the Number of Work Items Fact Collector config: