Repository navigation
Open
Labels
kind/enhancementAn entirely new featurekind/proposalIndicates maintainers have not yet committed to a feature requestneeds/areaIssue or PR needs to be labeled to indicate what parts of the code base are affectedneeds/priorityPriority has not yet been determined; a good signal that maintainers aren't fully committed
Description
Pre-submission checklist
- I have searched existing issues and confirmed this is not a duplicate.
- I understand that submitting a feature request does not guarantee it will be implemented.
Proposed Feature
I'd like a way to derive what versions were changed by a Promotion. The most straightforward way would be if the Promotion itself recorded the target stage's current Freight alongside the target Freight in its status when the Promotion starts.
Possible API shape:
diff --git a/api/v1alpha1/promotion_types.go b/api/v1alpha1/promotion_types.go
--- a/api/v1alpha1/promotion_types.go
+++ b/api/v1alpha1/promotion_types.go
@@ -410,6 +410,14 @@ type PromotionStatus struct {
Message string `json:"message,omitempty"`
// Freight is the detail of the piece of freight that was referenced by this promotion.
Freight *FreightReference `json:"freight,omitempty"`
+ // BaselineFreight contains the details of the Freight selected in the target
+ // Stage for the same origin as the Freight being promoted when this Promotion
+ // starts. It is unset if the Stage has no selection for that origin.
+ BaselineFreight *FreightReference `json:"baselineFreight,omitempty"`
+ // BaselineFreightCollection contains the details of all Freight selected in
+ // the target Stage when this Promotion starts. It is unset if the Stage has
+ // no current Freight collection.
+ BaselineFreightCollection *FreightCollection `json:"baselineFreightCollection,omitempty"`
// FreightCollection contains the details of the piece of Freight referenced
// by this Promotion as well as any additional Freight that is carried over
// from the target Stage's current state.Motivation and Use Case
For our internal UIs, we'd like to be able to show a list of PRs that are part of a given promotion. To do this, we need to compare the before- and after-promotion freights. As-is Kargo doesn't give us a reliable way to reconstruct that.
Alternatives Considered
A few ideas, but none are that clean:
- custom controller that writes this to an annotation when a Promotion switches from Pending to Running
- this races with Kargo's own controller if there are queued Promotions
- a mutating admission webhook that watches for the Pending -> Running transition
- this is a subresource patch on
statusand there's nowhere in Promotions status to put this info; the natural place would be an annotation but since it's a subresource patch we can't write to top-level metadata
- this is a subresource patch on
- a controller that reads from the Stage's
freightHistoryafter the Pending -> Running transition, and writes to an annotation on the Promotion- I think this works, but it leaves a small window where the metadata is missing. I think there's a race where we could read too late and end up lying about the prior freight / freight collection.
Metadata
Metadata
Assignees
Labels
kind/enhancementAn entirely new featurekind/proposalIndicates maintainers have not yet committed to a feature requestneeds/areaIssue or PR needs to be labeled to indicate what parts of the code base are affectedneeds/priorityPriority has not yet been determined; a good signal that maintainers aren't fully committed
Activity