Skip to content

feat(blueprints): add GitOps PostgreSQL zero-downtime migration verifier and lock risk guard - #343

Merged
MartinRst merged 2 commits into
kestra-io:mainfrom
somuai:feat-gitops-postgres-migration-guard
Oct 4, 2026
Merged

MartinRst merged 2 commits into
kestra-io:mainfrom
somuai:feat-gitops-postgres-migration-guard

Conversation

@somuai

@somuai somuai commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

Adds an enterprise-grade production workflow blueprint: GitOps PostgreSQL Zero-Downtime Migration Verifier and Lock Risk Guard (flows/gitops-postgres-migration-guard.yaml).

Blueprint

  • File: flows/gitops-postgres-migration-guard.yaml
  • ID: gitops-postgres-migration-guard
  • Namespace: company.team
  • Tags: Infrastructure, Data, Cloud

What it does

  1. GitOps Webhook & Event Integration: Triggered automatically by GitHub Actions CI when pull requests introduce or modify SQL migration files.
  2. DDL AST Static Lock Analysis: Runs comprehensive static analysis over migration DDL inspecting:
    • ACCESS EXCLUSIVE lock escalation (column type changes, unconstrained ALTER TABLE, adding non-null columns without defaults).
    • Missing CONCURRENTLY keyword on CREATE INDEX and DROP INDEX.
    • Foreign key constraints created without supporting indexes (causing table-level share locks on parent tables).
    • Circular Row-Level Security (RLS) recursion anti-patterns without SECURITY DEFINER wrappers.
  3. Transactional Dry-Run Sandbox: Executes the migration against a staging PostgreSQL database inside an explicit BEGIN ... ROLLBACK transaction block using io.kestra.plugin.jdbc.postgresql.Queries to measure execution time and verify SQL syntax with zero persistent side effects.
  4. Risk Evaluation Gate & GitHub/Slack Feedback:
    • High-Risk: Dispatches emergency Slack alert with anti-pattern analysis and recommended safe SQL rewrites.
    • Safe: Issues certification approval and logs deployment clearance.
  5. Audit Logging & Resilient Error Handling: Emits structured compliance records with full lineage.

Prerequisites

  • Staging PostgreSQL instance URL (STAGING_POSTGRES_URL).
  • Slack Incoming Webhook URL (SLACK_WEBHOOK_URL).
  • Migration Webhook Secret Key (MIGRATION_WEBHOOK_KEY).

Validation

  • PyYAML syntax validated.
  • Blueprint tag workflow (.github/workflows/validate-blueprint-tags.yml) verified: valid tags, metaDescription length <= 160 characters.
  • 100% emoji-free output.

@kestrabot kestrabot Bot added this to Pull Requests Oct 2, 2026

@MartinRst MartinRst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@MartinRst
MartinRst merged commit 0d37542 into kestra-io:main Oct 4, 2026
@MilosPaunovic MilosPaunovic added the kind/external Pull requests raised by community contributors label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants