Skip to content

Commit

Permalink
fix(ui): downstream promotion (#2650)
Browse files Browse the repository at this point in the history
Signed-off-by: Mayursinh Sarvaiya <[email protected]>
Co-authored-by: Kent Rancourt <[email protected]>
  • Loading branch information
Marvin9 and krancour authored Oct 4, 2024
1 parent 694504d commit e6b2329
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions internal/api/promote_downstream_v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ func (s *server) PromoteDownstream(
createdPromos := make([]*kargoapi.Promotion, 0, len(downstreams))
for _, downstream := range downstreams {
newPromo := kargo.NewPromotion(ctx, downstream, freight.Name)
if downstream.Spec.PromotionMechanisms == nil { // nolint: staticcheck
// nolint: staticcheck
if downstream.Spec.PromotionMechanisms == nil &&
downstream.Spec.PromotionTemplate != nil &&
len(downstream.Spec.PromotionTemplate.Spec.Steps) == 0 {
// Avoid creating a Promotion if the downstream Stage has no
// PromotionMechanisms, and is a "control flow" Stage.
// PromotionMechanisms, and no promotion steps and is a "control flow" Stage.
continue
}
if err := s.createPromotionFn(ctx, &newPromo); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion ui/src/features/project/pipelines/nodes/stage-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export const StageNode = ({
{action !== FreightTimelineAction.ManualApproval &&
action !== FreightTimelineAction.PromoteFreight && (
<>
{(stage.spec?.promotionMechanisms || stage.spec?.promotionTemplate) && (
{(stage.spec?.promotionMechanisms ||
!!stage.spec?.promotionTemplate?.spec?.steps?.length) && (
<Nodule
begin={true}
nodeHeight={height}
Expand Down

0 comments on commit e6b2329

Please sign in to comment.