Skip to content

Commit 30ef17f

Browse files
authored
fix(ctp): list PRs in ns (#708)
Signed-off-by: Michael Crenshaw <[email protected]>
1 parent 7ce05e0 commit 30ef17f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/controller/changetransferpolicy_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ func (r *ChangeTransferPolicyReconciler) mergePullRequests(ctx context.Context,
891891
prl := promoterv1alpha1.PullRequestList{}
892892
// Find the PRs that match the proposed commit and the environment. There should only be one.
893893
err := r.List(ctx, &prl, &client.ListOptions{
894+
Namespace: ctp.Namespace,
894895
LabelSelector: labels.SelectorFromSet(map[string]string{
895896
promoterv1alpha1.PromotionStrategyLabel: utils.KubeSafeLabel(ctp.Labels[promoterv1alpha1.PromotionStrategyLabel]),
896897
promoterv1alpha1.ChangeTransferPolicyLabel: utils.KubeSafeLabel(ctp.Name),
@@ -902,7 +903,7 @@ func (r *ChangeTransferPolicyReconciler) mergePullRequests(ctx context.Context,
902903
}
903904

904905
if len(prl.Items) > 1 {
905-
return nil, fmt.Errorf("more than one PullRequest found for ChangeTransferPolicy %s and Environment %s", ctp.Name, ctp.Spec.ActiveBranch)
906+
return nil, tooManyPRsError(&prl)
906907
}
907908

908909
if len(prl.Items) != 1 {

0 commit comments

Comments
 (0)