(opts auditJobRunOptions, jobLogContent string)
| 997 | } |
| 998 | |
| 999 | func extractRequestedStepOutput(opts auditJobRunOptions, jobLogContent string) error { |
| 1000 | stepOutput, err := extractStepOutput(jobLogContent, opts.stepNumber) |
| 1001 | if err != nil { |
| 1002 | if opts.verbose { |
| 1003 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Could not extract step %d output: %v", opts.stepNumber, err))) |
| 1004 | } |
| 1005 | return nil |
| 1006 | } |
| 1007 | stepLogPath := filepath.Join(opts.outputDir, fmt.Sprintf("job-%d-step-%d.log", opts.jobID, opts.stepNumber)) |
| 1008 | if err := os.WriteFile(stepLogPath, []byte(stepOutput), constants.FilePermSensitive); err != nil { |
| 1009 | return fmt.Errorf("failed to write step log: %w", err) |
| 1010 | } |
| 1011 | if opts.verbose { |
| 1012 | fmt.Fprintln(os.Stderr, console.FormatSuccessMessage(fmt.Sprintf("Step %d output saved to %s", opts.stepNumber, stepLogPath))) |
| 1013 | } |
| 1014 | return nil |
| 1015 | } |
| 1016 | |
| 1017 | func extractFirstFailingStepOutput(opts auditJobRunOptions, jobLogContent string) error { |
| 1018 | failingStepNum, failingStepOutput := findFirstFailingStep(jobLogContent) |
no test coverage detected