Skip to main content

More Controls for PR Promotion

Would it be possible to require a PR Promotion run to be a minimum # of days old from mainline? Basically, we want to avoid a case where a user makes a PR, leaves it for X days and then decides to promote it for testing without realizing its out of date. This is mainly for risk reduction, not total avoidance of issues with shared state terraform states.

Workaround
Not really.
Problem
Status: ⬆️ Gathering votes4 comments

Log in to comment and vote

Comments4

  • Brown Mole

    •

    Oct 22

    +1. We hit the same root problem from a different direction: the policies that run when a run is promoted (approval, plan) don’t see the PR’s state, and the push policy, which does, only runs when a run is created.

    For us the gap is approval: we want people to be able to promote and apply a PR’s plan, but only once GitHub reports the PR approved by a code owner and mergeable. Today we have to reject every promotion of a PR run in an approval policy and send people through a /spacelift deploy comment handled by the push policy instead.

    One change would cover both cases: include the PR’s current approved, mergeable and undiverged (plus something like commit age or how far behind the base branch it is) in the approval policy input when a promoted run is evaluated. The “prevent promoting if behind main” comment above would be a check on undiverged.

    Filed our version here: https://feedback.spacelift.io/p/expose-github-pr-state-to-approval-policies-for-promoted-runs

  • Pink Darkmatter

    •

    Jun 15

    Similarly, I would like to be able to prevent Promoting a PR if it is behind the main branch.

  • Black Breeze

    •

    Jan 29

    Thanks for raising this @Geoff Webster !

    This deep level of custom control sounds like a good candidate for policy-level handling. Is it something you’d like to get as part of your policy input? Like the commit timestamp or the commit age?

    • Fuchsia Backpack

      •

      Apr 23

      If that might work sure. I’m not sure I’ve tested policies in Spacelift that much recently.