sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

fix: CI/CD Bot exit early before applying plan on unmergeable PR

Open bcrant opened this issue 2 weeks ago • 1 comments

What does this PR do?

On final step of CI/CD, applying plan to prod, exit early (raise an error) before applying plan to prod if the PR merge state status is "blocked".

Why? It is currently possible for synchronized deployments to get into a bad state, where the changes in a PR have been applied to the production environment but have not been merged (desychronized), with the following configurations:

  • Sychronized deployment
  • CI/CD Bot configured to use Deploy Command Signal
  • CI/CD Bot is NOT configured to use Required Approval Signal
  • Repository has Github CODEOWNERS branch protection rules

This is currently possible because the GithubController.deploy_to_prod() checks explicitly checks for "is_dirty" state, but if the only thing missing is CODEOWNER approval, the merge state status "is_blocked", not "is_dirty". https://docs.github.com/en/enterprise-cloud@latest/graphql/reference/enums#mergestatestatus

bcrant avatar Nov 12 '25 00:11 bcrant

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 12 '25 00:11 CLAassistant