feat: add composable promotion gate framework#6592
Draft
jsbroks wants to merge 1 commit into
Draft
Conversation
Introduce pkg/promotion/gate, a small framework for deciding whether a Promotion may be created for a given Stage/Freight pair. Gates are predicates that allow, deny, or defer (via RequeueAfter). They are composed with an ordered AND Set and evaluated through Default()/ DefaultEvaluate(). Built-in gates live in the builtin package, one per file: - namespace: Freight and Stage must reside in the same namespace (Project). - requested-origin: the Stage must request Freight from the Freight's origin. - availability: Freight must be approved, sourced directly, or verified in the required upstream Stage(s). - soak-time: Freight must meet its required soak time; approval bypasses it. This separates static eligibility (a stable invariant) from dynamic soak policy, keeps each check single-responsibility, and gives every denial a specific, human-readable message. Signed-off-by: Justin Brooks <justin.brooks@akuity.io>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #
Introduces
pkg/promotion/gate, a small, composable framework for decidingwhether a Promotion may be created for a given Stage/Freight pair.
Gates are simple predicates that allow, deny, or defer (via a
RequeueAfter). They are composed with an ordered ANDSetand evaluatedthrough
Default()/DefaultEvaluate(). Each built-in gate lives in thebuiltinpackage, one per file, with a single responsibility and its ownspecific denial message:
the required upstream Stage(s) (honoring the availability strategy).
Shared types (
PromotionGate,PromotionInput,Decision) live in atypessubpackage to keep the framework and its built-in gates free of importcycles.
PromotionInput.FreightRequest()resolves the applicableFreightRequestby origin so individual gates don't re-derive it.This separates static eligibility (a stable invariant) from dynamic soak
policy, keeps each check single-responsibility, and makes denials
human-readable and easy to observe.
Checklist
Eligibility
kind/proposal,needs discussion,needs research,maintainer only,area/security,size/large,size/x-large,size/xx-large).Quality
AI Use Disclosure
This PR was written:
Sign-Off
All commits:
git commit -s) (required)git commit -S) (encouraged)Made with Cursor