Operations
AuraScore 81/100

Automated Canary Release Rollback Orchestrator Generator

Generate an automated shell and API orchestration script for instant canary rollback and incident notification based on telemetry drift.

Use this template when canary deployments exhibit anomalous latency or error spikes and platform operations teams require a hardened, idempotent rollback script. It coordinates cluster state reversion, traffic draining, and on-call paging.

Template

Role: Principal Site Reliability Engineer & Platform Operations Architect

Context

  • Target Microservice: {{service_name}}
  • Runtime Environment: {{deployment_environment}}
  • Health Metric Boundaries: {{telemetry_thresholds}}
  • Deployment Infrastructure: {{orchestration_engine}}
  • Alerting Channel Integration: {{pagerduty_service_key}}
  • Rollback Execution Protocol: {{rollback_strategy}}

Task

Generate an executable, production-grade Bash and API orchestration script that monitors canary health against defined metric boundaries, executes an immediate zero-downtime rollback if degradation occurs, and logs execution telemetry to incident responders.

Method

  1. Initialize safe execution defaults (set -euo pipefail) and parse environment runtime credentials.
  2. Ingest {{telemetry_thresholds}} and initialize active polling against Prometheus or Datadog APIs.
  3. Implement a bounded polling loop evaluating sliding window metrics against baseline criteria.
  4. Define an evaluation branch assessing canary HTTP 5xx rates, P99 latency, and host resource utilization.
  5. Upon anomaly detection, invoke {{orchestration_engine}} API endpoints to instantly divert ingress traffic back to stable baseline pods.
  6. Execute the {{rollback_strategy}} sequence to terminate degraded canary instances safely without connection drops.
  7. Dispatch an automated high-urgency incident payload to {{pagerduty_service_key}} containing trigger metrics, blast radius stats, and pod execution logs.
  8. Emit structured JSON execution logs detailing script start time, metric snapshots, mitigation timestamps, and final cluster state.

Constraints

  • MUST include rigorous error trapping and exit traps to ensure no orphaned canary containers remain active on failure.
  • MUST NOT expose raw API credentials or tokens; extract them strictly from injected environment secrets.
  • Script logic MUST be fully idempotent so repeated executions do not corrupt production deployment state.
  • Do not use non-standard shell dependencies beyond curl, jq, and core system utilities.

Output format

Provide the deliverable in two strict sections:

  1. SCRIPT_HEADER: Configuration block defining environment variables, threshold constants, and dependency validation.
  2. SCRIPT_BODY: Complete, comment-annotated POSIX-compliant Bash script (under 250 lines) formatted within a single code block.

Self-review

  • Ensure every shell parameter expansion is quoted to prevent injection vulnerabilities.
  • Verify API query syntax against the declared {{orchestration_engine}} spec.
  • Confirm all exit codes map distinctly to successful rollback, telemetry timeout, or API communication errors.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

business-strategy
business-operations
software-engineering-debugging
devops
reliability
canary-release