You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(STONEINTG-1677): consolidated Gitlab status reporting
- add HTTP 422 as unrecoverable across all three forge reporters
- add ReportConsolidatedStatus to reporter.go GitLab posts a
single "X/Y passed" status when scenario count exceeds the
per-pipeline job threshold; GitHub and Forgejo are no-ops
- propagate IsOptional through TestReport so optional failures do
not set the consolidated status to failed
- add threshold config via GITLAB_MAX_INDIVIDUAL_STATUSES env var
(default 50) with adapter routing logic
- unit tests for consolidated status, transition error suppression,
and threshold routing
Assisted by: Cursor AI
Signed-off-by: jcullina <jcullina@redhat.com>
// set isFinalStatus to true if there is at least one integration test status is in final status, which means the comment for integration test might not be updated again to have only one comment for each component
returnfmt.Errorf("failed to generate comment for status of integration test scenario %s/%s : %w", testedSnapshot.Namespace, testReport.ScenarioName, err)
@@ -554,38 +557,70 @@ func (a *Adapter) iterateIntegrationTestStatusDetailsInStatusReport(reporter sta
a.logger.Info("Integration Test contains new status updates", "scenario.Name", integrationTestStatusDetail.ScenarioName, "destinationSnapshot.Name", destinationSnapshot.Name, "testedSnapshot", testedSnapshot.Name)
560
-
561
-
} else {
562
-
//integration test contains no changes
563
-
a.logger.Info("Integration Test doen't contain new status updates", "scenario.Name", integrationTestStatusDetail.ScenarioName)
564
-
continue
565
-
}
562
+
// When the number of scenarios exceeds the configured threshold for GitLab or
563
+
// Forgejo reporters, post a single consolidated commit status instead of one
564
+
// per scenario to avoid exhausting the provider's per-pipeline job limit.
a.logger.Error(reportStatusErr, fmt.Sprintf("failed to report status to git provider for completed integration pipelinerun %s/%s, then finalizer test.appstudio.openshift.io/pipelinerun might not be removed from it later", testedSnapshot.Namespace, integrationTestStatusDetail.TestPipelineRunName))
570
-
}
568
+
ifuseConsolidated {
569
+
a.logger.Info("Scenario count exceeds threshold, using consolidated commit status",
a.logger.Error(reportStatusErr, fmt.Sprintf("failed to report status to git provider for integration pipelinerun %s/%s, the statusCode %d is not easily recoverable", testedSnapshot.Namespace, integrationTestStatusDetail.TestPipelineRunName, statusCode))
575
+
a.logger.Error(reportErr, "consolidated status report failed with unrecoverable error, skipping",
576
+
"statusCode", statusCode)
574
577
returnnil
575
-
} else {
576
-
returnfmt.Errorf("failed to update status: %w", reportStatusErr)
577
578
}
579
+
returnfmt.Errorf("failed to report consolidated status: %w", reportErr)
578
580
}
579
581
580
-
ifwriteErr:=status.WriteSnapshotReportStatus(a.context, a.client, testedSnapshot, srs); writeErr!=nil { // try to write what was already written
581
-
returnfmt.Errorf("failed to report status AND write snapshot report status metadata: %w", writeErr)
582
+
// Mark all scenarios as reported so they are not re-reported on the next reconcile
a.logger.Info("Integration Test contains new status updates", "scenario.Name", integrationTestStatusDetail.ScenarioName, "destinationSnapshot.Name", destinationSnapshot.Name, "testedSnapshot", testedSnapshot.Name)
596
+
} else {
597
+
a.logger.Info("Integration Test doen't contain new status updates", "scenario.Name", integrationTestStatusDetail.ScenarioName)
a.logger.Error(reportStatusErr, fmt.Sprintf("failed to report status to git provider for completed integration pipelinerun %s/%s, then finalizer test.appstudio.openshift.io/pipelinerun might not be removed from it later", testedSnapshot.Namespace, integrationTestStatusDetail.TestPipelineRunName))
a.logger.Error(reportStatusErr, fmt.Sprintf("failed to report status to git provider for integration pipelinerun %s/%s, the statusCode %d is not easily recoverable", testedSnapshot.Namespace, integrationTestStatusDetail.TestPipelineRunName, statusCode))
608
+
returnnil
609
+
} else {
610
+
returnfmt.Errorf("failed to update status: %w", reportStatusErr)
0 commit comments