buildFallbackReportData builds report data for fallback validation results
(fallbackResults []validate_utils.Result, vsaData *validateVSAData)
| 1087 | |
| 1088 | // buildFallbackReportData builds report data for fallback validation results |
| 1089 | func buildFallbackReportData(fallbackResults []validate_utils.Result, vsaData *validateVSAData) (validate_utils.ReportData, error) { |
| 1090 | components, manyPolicyInput, err := validate_utils.CollectComponentResults( |
| 1091 | fallbackResults, |
| 1092 | func(r validate_utils.Result) error { |
| 1093 | return fmt.Errorf("error validating image %s of component %s: %w", |
| 1094 | r.Component.ContainerImage, r.Component.Name, r.Err) |
| 1095 | }, |
| 1096 | ) |
| 1097 | if err != nil { |
| 1098 | return validate_utils.ReportData{}, fmt.Errorf("failed to collect fallback components: %w", err) |
| 1099 | } |
| 1100 | |
| 1101 | return validate_utils.ReportData{ |
| 1102 | Snapshot: vsaData.images, |
| 1103 | Components: components, |
| 1104 | Policy: vsaData.fallbackContext.FallbackPolicy, |
| 1105 | PolicyInputs: manyPolicyInput, |
| 1106 | Expansion: nil, |
| 1107 | ShowSuccesses: false, |
| 1108 | ShowWarnings: true, |
| 1109 | ShowPolicyDocsLink: vsaData.showPolicyDocsLink, |
| 1110 | }, nil |
| 1111 | } |
| 1112 | |
| 1113 | // createFallbackReport creates a fallback report without writing it |
| 1114 | // This is used when we need to combine VSA and fallback output into a single file |
no test coverage detected