Retain producer files after failed extraction

This commit is contained in:
2026-11-30 03:58:26 +00:00
parent 7ad6b718a0
commit b6492ab4e8
3 changed files with 36 additions and 10 deletions

View File

@@ -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
}