Integrate extraction lifecycle and resume validation
This commit is contained in:
@@ -171,6 +171,31 @@ func executeStages(ctx context.Context, cfg *config.Config, stages []stage.Stage
|
||||
for _, d := range decisions {
|
||||
s := d.Stage
|
||||
runNames = append(runNames, s.Name())
|
||||
if d.Action == stageActionSkip && !stageSucceeded(m, s.Name()) {
|
||||
d.Action = stageActionRun
|
||||
}
|
||||
|
||||
if d.Action == stageActionSkip {
|
||||
if validator, ok := s.(stage.ResumeValidator); ok {
|
||||
validation, err := validator.ValidateResume(ctx, stageEnv, m)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("validate resume for stage %q: %w", s.Name(), err)
|
||||
}
|
||||
validation = validation.Normalized()
|
||||
if !validation.Resumable {
|
||||
staleAt := nowUTC()
|
||||
m.MarkStageStale(s.Name(), staleAt, validation.Reason)
|
||||
invalidateDownstreamSucceededStagesWithReason(
|
||||
m, s.Name(), staleAt, "upstream stage result was not resumable",
|
||||
)
|
||||
if err := env.ManifestStore.Save(ctx, manifestPath, m); err != nil {
|
||||
return nil, fmt.Errorf("save manifest after resume validation for stage %q: %w", s.Name(), err)
|
||||
}
|
||||
env.Logger.Info("stage result is not resumable", "stage", s.Name(), "reason", validation.Reason)
|
||||
d.Action = stageActionRun
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if d.Action == stageActionSkip {
|
||||
skipped = append(skipped, s.Name())
|
||||
|
||||
Reference in New Issue
Block a user