Reuse credential discovery and diagnostic redactors
This commit is contained in:
@@ -17,9 +17,9 @@ import (
|
||||
func finishProcess(inv commandkit.Invocation, input processInput, loaded *processInputs, prepared *preparedProcess, snapshot reporting.Snapshot, transcript []byte, primary error) commandkit.Outcome {
|
||||
reporter := inv.Reporter()
|
||||
secrets := loaded.Runtime.ConfiguredSecrets(inv.Context)
|
||||
redact := func(err error) string { return loaded.Runtime.RedactError(inv.Context, err) }
|
||||
safe := redaction.New(secrets)
|
||||
for _, warning := range prepared.Prepared.Warnings {
|
||||
_ = reporter.Warn("Debug artifact: " + redact(warning))
|
||||
_ = reporter.Warn("Debug artifact: " + safe.String(warning.Error()))
|
||||
}
|
||||
completed := time.Now().UTC()
|
||||
snapshot.RunID, snapshot.StartedAt, snapshot.CompletedAt = prepared.RunID, prepared.Started, &completed
|
||||
@@ -52,9 +52,8 @@ func finishProcess(inv commandkit.Invocation, input processInput, loaded *proces
|
||||
}
|
||||
result := prepared.Prepared.Output.Finish(primary, transcript, reports, failed)
|
||||
if result != nil {
|
||||
return commandkit.Failure(redact(result)).WithCause(result)
|
||||
return commandkit.Failure(safe.String(result.Error())).WithCause(result)
|
||||
}
|
||||
safe := redaction.New(secrets)
|
||||
_ = reporter.AtEnd().Info(reporting.CompletionLine(snapshot))
|
||||
for _, path := range prepared.Prepared.Output.ReportPaths() {
|
||||
_ = reporter.AtEnd().Info(fmt.Sprintf("Report: %s", safe.String(path)))
|
||||
|
||||
Reference in New Issue
Block a user