Request icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon
Schedule icon

Sentry Bad Release Automated Rollback Gate

Detect Sentry error bursts on new releases, evaluate error thresholds, and trigger automated deployment rollbacks with incident notifications via Kestra.

Categories
CloudInfrastructure

Automated canary and release health evaluation sentinel that monitors Sentry for error velocity and actively executes automated deployment rollbacks when failure thresholds are breached.

How it works

  1. A schedule trigger runs every 10 minutes during active deployment windows, or executes on-demand post-deployment.
  2. The first HTTP request task queries Sentry's Releases API to verify release metadata and adoption status.
  3. The second HTTP request queries the Sentry Issues API for new unresolved issues whose firstRelease matches the active deployment version.
  4. An inline Python task evaluates error counts and event volume against configured tolerances, raising explicit exceptions if Sentry credentials or endpoints fail.
  5. A conditional flow gate evaluates whether error thresholds were breached.
  6. When a bad release is detected, the workflow actively dispatches a rollback event to GitHub Actions via repository dispatch, instructing CI/CD to roll back to the previous stable release.
  7. A high-priority incident notification is dispatched to Slack with error counts, culprit issue titles, and rollback dispatch confirmation.
  8. A log task writes an audit trace of the verification and rollback decision.

What you get

  • Active automated rollback execution without requiring human intervention during critical production outages.
  • Zero silent failures: strictly verifies real API responses and fails loudly on network or credential faults.
  • Automated post-deployment stabilization and safety gating for continuous delivery pipelines.

Who it's for

  • DevOps and Platform Engineers operating automated GitOps and continuous delivery pipelines.
  • Site Reliability Engineers establishing automated mean-time-to-recovery (MTTR) safeguards.
  • Release Managers automating canary release verification and automated rollbacks.

Why orchestrate this with Kestra

  • Connects error observability (Sentry) directly to deployment execution (GitHub Actions / CI/CD) in a single declarative flow.
  • Secure credential management keeping Sentry and GitHub personal access tokens masked in logs.
  • Conditional execution branching and retry policies ensure reliable automated remediation.

Prerequisites

  • A Sentry organization and project with API access.
  • Sentry Internal Integration auth token with project:read and event:read scopes.
  • A GitHub repository with a workflow configured to receive rollback_deployment repository dispatches.
  • A Slack Incoming Webhook URL for alerting.

Secrets

  • SENTRY_AUTH_TOKEN: Sentry API token with project:read and event:read permissions.
  • SENTRY_ORG_SLUG: Sentry organization URL slug.
  • SENTRY_PROJECT_SLUG: Target Sentry project identifier.
  • GITHUB_REPOSITORY: Target GitHub repository in owner/repo format for rollback dispatch.
  • GITHUB_TOKEN: GitHub personal access token with repo scope to trigger repository dispatches.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for rollback incident alerts.

Quick start

  1. Configure the required Sentry, GitHub, and Slack secrets in your Kestra namespace.
  2. In your target GitHub repository, ensure a workflow listens for repository_dispatch with event type rollback_deployment.
  3. Execute the flow manually with test release versions to verify API authentication and gate logic.
  4. Enable the schedule trigger or call this flow via webhook as the final step of your deployment pipeline.

How to extend

  • Add direct Kubernetes deployment rollback using the Kestra Kubernetes plugin (kubectl rollout undo).
  • Integrate ArgoCD or Flux sync suspension to freeze GitOps sync during rollbacks.
  • Add multi-region traffic shifting to drain traffic from degraded clusters automatically.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.