Skip to content

Commit 7e13f63

Browse files
committed
fix: improve message when /retest has nothing to retest
When using /retest and all pipelines have already succeeded, show: "all PipelineRuns for this commit have already succeeded. Use /retest <pipeline-name> to re-run a specific pipeline or /test to re-run all" instead of the misleading "could not find any PipelineRun" message. Fixes: SRVKP-10373 Signed-off-by: Shubham Mathur <shumathu@redhat.com>
1 parent 419f3b5 commit 7e13f63

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/matcher/annotation_matcher.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,11 @@ func MatchPipelinerunByAnnotation(ctx context.Context, logger *zap.SugaredLogger
403403
if event.EventType == opscomments.RetestAllCommentEventType.String() ||
404404
event.EventType == opscomments.OkToTestCommentEventType.String() {
405405
logger.Debugf("MatchPipelinerunByAnnotation: filtering successful templates for event_type=%s", event.EventType)
406-
return filterSuccessfulTemplates(ctx, logger, cs, event, repo, matchedPRs), nil
406+
filtered := filterSuccessfulTemplates(ctx, logger, cs, event, repo, matchedPRs)
407+
if len(filtered) == 0 {
408+
return nil, fmt.Errorf("all PipelineRuns for this commit have already succeeded. Use /retest <pipeline-name> to re-run a specific pipeline or /test to re-run all")
409+
}
410+
return filtered, nil
407411
}
408412
return matchedPRs, nil
409413
}

0 commit comments

Comments
 (0)