Skip to content

Record baseline freight on promotions when they start. #8124

Open

Description

@kamalmarhubi

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 status and 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
  • a controller that reads from the Stage's freightHistory after 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.

Activity

  1. added
    kind/enhancement
    kind/proposal
    on Nov 23, 2026
  2. added
    needs/area
    needs/priority
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementkind/proposalneeds/areaneeds/priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions