Retain producer files after failed extraction
This commit is contained in:
@@ -151,14 +151,8 @@ func (extractStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (re
|
||||
ReportPath: reportPath, LogPath: logPath, Timeout: timeout, Cache: cache,
|
||||
Debug: notariusConfig.Debug, DebugDirectory: debugDirectory, References: referenceBindings,
|
||||
}
|
||||
accepted := false
|
||||
defer func() {
|
||||
if !accepted {
|
||||
if cleanupErr := fileops.RemoveAllUnderRoot(filepath.Dir(outputRoot), outputRoot); cleanupErr != nil {
|
||||
resultErr = errors.Join(resultErr, fmt.Errorf("extract: remove failed Notarius output root: %w", cleanupErr))
|
||||
}
|
||||
}
|
||||
}()
|
||||
// Producer files remain inspectable even when completion delivery fails.
|
||||
// Only Narratio's temporary promotion copies are cleaned below.
|
||||
adapterResult, err := env.Notarius.Run(ctx, request)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("extract: run notarius: %w", err)
|
||||
@@ -248,7 +242,6 @@ func (extractStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (re
|
||||
"completion": completion,
|
||||
}
|
||||
result = &StageResult{Outputs: outputs, Logs: []string{reportPath, logPath}, Metadata: metadata}
|
||||
accepted = true
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user