Update raw output files and manifests
This commit is contained in:
@@ -157,6 +157,7 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (output RunOutput, err
|
||||
} else {
|
||||
output.Manifest.ValidationStatus = "approved"
|
||||
}
|
||||
populateRawOutputManifest(&output)
|
||||
output.Manifest.CompletedAt = timePtr(time.Now().UTC())
|
||||
|
||||
encoder, err := r.registries.Outputs.Build(input.Pipeline.Output.Module)
|
||||
@@ -636,12 +637,64 @@ func manifestFromPipeline(input RunInput) artifacts.RunManifest {
|
||||
|
||||
func failOutput(output RunOutput) RunOutput {
|
||||
if output.Manifest.PipelineID != "" {
|
||||
populateRawOutputManifest(&output)
|
||||
output.Manifest.ValidationStatus = "failed"
|
||||
output.Manifest.CompletedAt = timePtr(time.Now().UTC())
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func populateRawOutputManifest(output *RunOutput) {
|
||||
if output == nil {
|
||||
return
|
||||
}
|
||||
output.Manifest.NormalizedOutputs = normalizedOutputManifests(output.NormalizeOutputs)
|
||||
output.Manifest.RejectedOutputs = rejectedOutputManifests(output.Rejected)
|
||||
}
|
||||
|
||||
func normalizedOutputManifests(outputs []contracts.NormalizeOutput) []artifacts.NormalizedOutputManifest {
|
||||
if len(outputs) == 0 {
|
||||
return nil
|
||||
}
|
||||
manifests := make([]artifacts.NormalizedOutputManifest, 0, len(outputs))
|
||||
for _, output := range outputs {
|
||||
manifests = append(manifests, artifacts.NormalizedOutputManifest{
|
||||
LaneID: output.LaneID,
|
||||
ModuleKey: output.NormalizerKey,
|
||||
SourceID: output.SourceID,
|
||||
MediaType: output.Payload.MediaType,
|
||||
Schema: artifacts.OutputSchemaProvenance{
|
||||
ID: output.Schema.ID,
|
||||
Name: output.Schema.Name,
|
||||
Version: output.Schema.Version,
|
||||
},
|
||||
})
|
||||
}
|
||||
return manifests
|
||||
}
|
||||
|
||||
func rejectedOutputManifests(rejected []contracts.RejectedOutput) []artifacts.RejectedOutputManifest {
|
||||
if len(rejected) == 0 {
|
||||
return nil
|
||||
}
|
||||
manifests := make([]artifacts.RejectedOutputManifest, 0, len(rejected))
|
||||
for _, output := range rejected {
|
||||
manifests = append(manifests, artifacts.RejectedOutputManifest{
|
||||
Stage: output.Stage,
|
||||
LaneID: output.LaneID,
|
||||
ModuleKey: output.ModuleKey,
|
||||
ChunkID: output.ChunkID,
|
||||
ChunkIndex: output.ChunkIndex,
|
||||
ValidatorName: output.ValidatorName,
|
||||
ReasonCode: output.ReasonCode,
|
||||
Message: output.Message,
|
||||
AttemptCount: output.AttemptCount,
|
||||
DiagnosticArtifactPath: output.DiagnosticArtifactPath,
|
||||
})
|
||||
}
|
||||
return manifests
|
||||
}
|
||||
|
||||
func setLaneManifestMetadata(output *RunOutput, laneID string, modules ...any) {
|
||||
if output == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user