Skip to content

ROB-834 Add workflow trigger action to fire Robusta platform workflows - #2133

Merged
arikalon1 merged 3 commits into
masterfrom
claude/robusta-alert-workflow-action-q0ztnb
Aug 4, 2026
Merged

ROB-834 Add workflow trigger action to fire Robusta platform workflows#2133
arikalon1 merged 3 commits into
masterfrom
claude/robusta-alert-workflow-action-q0ztnb

Conversation

@arikalon1

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new trigger_workflow action that enables Robusta playbooks to trigger platform Triggered Workflows (such as Holmes investigations) in response to Prometheus alerts. The action sends the complete alert payload and cluster context to the platform's webhooks endpoint.

Key Changes

  • New action module (playbooks/robusta_playbooks/workflow_trigger.py):

    • TriggerWorkflowParams: Configuration class supporting single or multiple workflow IDs, API authentication, optional cluster routing, and request timeout settings
    • build_workflow_trigger_payload(): Constructs webhook body containing the full alert payload (labels, annotations, status, timestamps, etc.) plus cluster name
    • trigger_workflow(): Main action that POSTs to the platform webhooks endpoint with proper query parameters and authorization headers
  • Comprehensive test suite (tests/test_workflow_trigger.py):

    • Tests payload structure and JSON serializability
    • Validates HTTP request format (headers, query parameters, body)
    • Tests multiple workflow ID support
    • Tests cluster routing behavior (opt-in and opt-out)
    • Tests error handling for HTTP failures and network unreachability

Notable Implementation Details

  • Alert payload is preserved byte-for-byte through JSON serialization, enabling workflow filters to match on any alert field
  • Supports triggering multiple workflows from a single alert via list of workflow IDs
  • Cluster routing is configurable: by default targets the alert's source cluster, but can be disabled to use the workflow's configured cluster
  • Includes proper error handling with descriptive messages for network failures and HTTP errors
  • Uses bearer token authentication with secure SecretStr for API keys
  • Includes comprehensive logging of successful workflow triggers

https://claude.ai/code/session_01SSJqTBghtypCiZUwDDvP7a

claude added 2 commits August 3, 2026 21:10
…an alert

New alert-triggered playbook action that POSTs the entire alert payload
(labels, annotations, status, timestamps, generatorURL, fingerprint) plus
the cluster name to the Robusta platform /webhooks endpoint with one or
more workflow_id params, starting a Triggered Workflow run — typically a
Holmes investigation. Optional route_to_alert_cluster targets the workflow
at the cluster the alert fired in via the cluster URL param.

Tested with a real HTTP capture server against a KubeNodeUnschedulable
(node cordoned) alert; the request contract is mirrored end-to-end in
relay's tests/test_workflow_trigger_alert_e2e.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJqTBghtypCiZUwDDvP7a
The triggered workflow now runs against the cluster the alert fired in by
default; set route_to_alert_cluster: false to keep the workflow
definition's configured cluster.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJqTBghtypCiZUwDDvP7a
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds the trigger_workflow action. It serializes Prometheus/Kubernetes alerts, sends authenticated requests to /webhooks, supports workflow and cluster routing options, handles failures, and adds integration tests.

Changes

Workflow webhook trigger

Layer / File(s) Summary
Workflow parameters and payload
playbooks/robusta_playbooks/workflow_trigger.py
Defines TriggerWorkflowParams and builds a payload containing the complete alert and cluster name.
Webhook request execution
playbooks/robusta_playbooks/workflow_trigger.py
Normalizes workflow IDs, builds query parameters, sends the authenticated POST request, validates responses, and logs success.
Webhook integration validation
tests/test_workflow_trigger.py
Tests payload serialization, request construction, workflow IDs, cluster routing, authentication, HTTP errors, and unreachable endpoints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PrometheusKubernetesAlert
  participant trigger_workflow
  participant RobustaPlatformWebhooks
  PrometheusKubernetesAlert->>trigger_workflow: provide alert and parameters
  trigger_workflow->>trigger_workflow: build payload and routing parameters
  trigger_workflow->>RobustaPlatformWebhooks: send authenticated POST request
  RobustaPlatformWebhooks-->>trigger_workflow: return HTTP response
  trigger_workflow-->>PrometheusKubernetesAlert: log success or raise ActionException
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the addition of the workflow trigger action and matches the main change.
Description check ✅ Passed The description directly explains the new workflow trigger action, its behavior, and the related tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/robusta-alert-workflow-action-q0ztnb

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Docker image ready for ec4f2c3 (built in 1m 25s)

⚠️ Warning: does not support ARM (ARM images are built on release only - not on every PR)

Use this tag to pull the image for testing.

📋 Copy commands

⚠️ Temporary images are deleted after 30 days. Copy to a permanent registry before using them:

gcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ec4f2c3
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:ec4f2c3 me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ec4f2c3
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ec4f2c3

Patch Helm values in one line:

helm upgrade --install robusta robusta/robusta \
  --reuse-values \
  --set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:ec4f2c3

@arikalon1 arikalon1 changed the title Add workflow trigger action to fire Robusta platform workflows ROB-834 Add workflow trigger action to fire Robusta platform workflows Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@playbooks/robusta_playbooks/workflow_trigger.py`:
- Line 54: Update the timeout field validation in the workflow trigger
parameters to accept only positive values, using Pydantic V1 validation such as
PositiveInt or an equivalent constraint. Add coverage for zero and negative
timeout inputs, ensuring both are rejected during parameter validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1fa94bc6-63fa-4f0b-99cd-b09c09025fb9

📥 Commits

Reviewing files that changed from the base of the PR and between d29c823 and 7921ea9.

📒 Files selected for processing (2)
  • playbooks/robusta_playbooks/workflow_trigger.py
  • tests/test_workflow_trigger.py

Comment thread playbooks/robusta_playbooks/workflow_trigger.py
@ezra-robusta
ezra-robusta self-requested a review August 4, 2026 19:36
@arikalon1
arikalon1 merged commit ace707c into master Aug 4, 2026
7 checks passed
@arikalon1
arikalon1 deleted the claude/robusta-alert-workflow-action-q0ztnb branch August 4, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants