Skip to content

Tracking of Critical Changes in Merge Requests

This guide provides a detailed approach to tracking critical changes that require special attention within your codebase through merge requests. Teamscale automatically generates and adds critical change badges to merge requests in your code collaboration platform, while also displaying an in-depth overview of these critical changes in the Teamscale merge request details view. By configuring regex patterns, you can identify critical paths or methods, ensuring that crucial changes receive the necessary attention during the review process.

Beta (Limited Availability)

This feature is currently in a Beta state and only available for Bitbucket Data Center. Please contact our support to request this feature for other code collaboration platforms.

Connector Configuration

If Teamscale supports this feature for your code collaboration platform, the respective connector will offer an option to add Badges for Critical Changes.

  1. In the connector configuration, click on Advanced Settings.
  2. In the Badges for Critical Changes option, click the Add new badge button to open a dialog for configuring a critical change badge.
  3. Configure each badge with the following:
    • Badge Title: The text to be displayed on the left side of the badge.
    • Badge Text: The text to be displayed on the right side of the badge.
    • Badge Description: Markdown-supported text explaining the purpose of this badge. This text will be displayed in the merge request detail view.
    • Critical Change Patterns: The regex patterns defining critical changes that should trigger posting of the badge. Details on the regex pattern format are described below.
    • Badge Color: Background color of the badge.
    • Badge Hover Text (optional): Tooltip text shown when hovering over the badge.
    • Badge Link (optional): URL to be opened when clicking on the badge. If left empty, clicking on the badge will navigate to the merge request detail view. Configuration of a critical change badge
  4. Click OK to save your input.
  5. Save the project configuration after configuring all the critical change badges you want. Connector configuration with multiple configured critical change badges

Updates in Merge Requests

Changes in this configuration are only updated in merge requests on the next vote. This includes adding, editing, or removing any badges from the configuration.

Critical Change Pattern Format

You can define two types of patterns:

  1. File-only Patterns: Match files by their path. For example:
regexp
src/main/java/com/example/security/.*

This pattern matches any file in the security package.

  1. Method Patterns: Match specific methods within specific files using a # separator. For example:
regexp
src/main/java/com/example/security/.*#authenticate.*

This pattern matches any method starting with authenticate in any file within the security package.

Viewing Critical Changes in Merge Requests

When a merge request contains critical changes:

  1. Critical change badges appear at the top of the merge request.

Bitbucket pull request with critical change badges

  1. Critical Changes section is displayed in the merge request details. Each badge has an expandable section showing:
    • The badge description.
    • A table listing all matched critical locations (files or methods).
    • Clicking a critical location navigates to that specific file or method.

Critical changes section in the merge request detail view

Best Practices

  • Be specific with patterns and use method patterns for precision in order to avoid overly broad patterns and minimize noise.
  • Use meaningful badge titles and descriptions to aid reviewers in understanding the critical nature of changes.
  • Group related patterns and create separate badges for different critical change categories.
  • Keep badge title and text concise to ensure readability in the UI.