Proof of Work: type: custom in summary rules (gitlab-triage!364)

Overview

This MR demonstrates proof of work for the type: custom feature in gitlab-triage!364.

The feature enables summary rules to include custom data without fetching GitLab resources, which is useful for integrating external data sources like ClickHouse, Prometheus, or custom APIs.

What's Included

Test Policies

Three test policies to validate the feature:

  1. policies/test-custom-type-only.yml - Demonstrates valid usage with 3 custom type rules:

    • ClickHouse Metrics (simulated)
    • Prometheus Alerts (simulated)
    • Test Quarantine Summary (simulated)
  2. policies/test-custom-type.yml - Mixed example with both regular GitLab resources and custom data

  3. policies/test-custom-type-invalid.yml - Demonstrates invalid usage (custom type in top-level rule)

Modified Gemfile

Updated to use local gitlab-triage from the add-custom-type-support branch to test the feature.

Test Results

Positive Test - Custom Type in Summary Rules

Command:

bundle exec gitlab-triage --dry-run \
  --token "$GITLAB_BOT_API_TOKEN_ON_COM" \
  --source projects --source-id 278964 \
  -f policies/test-custom-type-only.yml

Output:

Processing summary: **Custom Data Only Summary**

Gathering resources for rule: **ClickHouse Metrics**
* Skipping resource fetch for custom type rule

Gathering resources for rule: **Prometheus Alerts**
* Skipping resource fetch for custom type rule

Gathering resources for rule: **Test Quarantine Summary**
* Skipping resource fetch for custom type rule

Result: All custom rules executed without fetching GitLab resources. No API calls were made.

Negative Test - Invalid Usage Detection

Command:

bundle exec gitlab-triage --dry-run \
  --token "$GITLAB_BOT_API_TOKEN_ON_COM" \
  --source projects --source-id 278964 \
  -f policies/test-custom-type-invalid.yml

Output:

type: custom can only be used in summary rules, not in top-level rules 
(rule: Invalid Custom Rule) (ArgumentError)

Result: Validation correctly prevents misuse with a clear error message.

Use Cases

This feature enables real-world scenarios like:

  • ClickHouse integration: Include quarantine test data without GitLab API calls (as seen in triage-ops!3804)
  • Prometheus metrics: Add system metrics to triage reports
  • Custom APIs: Integrate third-party data sources
  • Static sections: Include informational content in summaries

Next Steps

This MR is for proof of work and review purposes only. Once reviewed:

  • Close this MR (do not merge)
  • The validation confirms gitlab-triage!364 is ready to merge and release

Merge request reports

Loading