(opts auditJobRunOptions, jobLogContent string)
| 1015 | } |
| 1016 | |
| 1017 | func extractFirstFailingStepOutput(opts auditJobRunOptions, jobLogContent string) error { |
| 1018 | failingStepNum, failingStepOutput := findFirstFailingStep(jobLogContent) |
| 1019 | if failingStepNum == 0 { |
| 1020 | if opts.verbose { |
| 1021 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No failing steps found in job")) |
| 1022 | } |
| 1023 | return nil |
| 1024 | } |
| 1025 | stepLogPath := filepath.Join(opts.outputDir, fmt.Sprintf("job-%d-step-%d-failed.log", opts.jobID, failingStepNum)) |
| 1026 | if err := os.WriteFile(stepLogPath, []byte(failingStepOutput), constants.FilePermSensitive); err != nil { |
| 1027 | return fmt.Errorf("failed to write failing step log: %w", err) |
| 1028 | } |
| 1029 | if opts.verbose { |
| 1030 | fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("First failing step %d output saved to %s", failingStepNum, stepLogPath))) |
| 1031 | } |
| 1032 | return nil |
| 1033 | } |
| 1034 | |
| 1035 | func renderAuditJobSummary(opts auditJobRunOptions, jobLogPath string) { |
| 1036 | if opts.jsonOutput { |
no test coverage detected