Skip preflight evidence setup when capture is disabled
This commit is contained in:
@@ -176,16 +176,20 @@ func executePreflight(invocation commandkit.Invocation, input pipelineRunInput,
|
||||
add("debug", preflightScope{Path: capture.Path()}, "failed", err.Error())
|
||||
return finish(commandkit.Failure(err.Error()).WithCause(err))
|
||||
}
|
||||
evidence := newRunEvidenceRecorder(capture, loaded.result)
|
||||
evidenceIndex := 0
|
||||
observations, err := preflight.RunSmokeChecksObserved(ctx, selected.engine, targets, input.Overrides.Execution.Execution, input.Overrides.Execution.TransientRetries, func(observation preflight.SmokeObservation) error {
|
||||
if observation.Report != nil {
|
||||
err := evidence.WriteJSON(fmt.Sprintf("smoke/%03d.json", evidenceIndex), observation.Report)
|
||||
evidenceIndex++
|
||||
return err
|
||||
var observe func(preflight.SmokeObservation) error
|
||||
if capture.Enabled() {
|
||||
evidence := newRunEvidenceRecorder(capture, loaded.result)
|
||||
evidenceIndex := 0
|
||||
observe = func(observation preflight.SmokeObservation) error {
|
||||
if observation.Report != nil {
|
||||
err := evidence.WriteJSON(fmt.Sprintf("smoke/%03d.json", evidenceIndex), observation.Report)
|
||||
evidenceIndex++
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
observations, err := preflight.RunSmokeChecksObserved(ctx, selected.engine, targets, input.Overrides.Execution.Execution, input.Overrides.Execution.TransientRetries, observe)
|
||||
failedCheck := false
|
||||
for _, observation := range observations {
|
||||
if !observation.Applicable {
|
||||
|
||||
Reference in New Issue
Block a user