Merge pull request #222 from sgotti/executor_fix_reporting_of_stopped_tasks_and_steps

executor: fix reporting of stopped tasks and steps
This commit is contained in:
Simone Gotti 2020-02-28 09:55:40 +01:00 committed by GitHub
commit a4e280cd7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -776,7 +776,11 @@ func (e *Executor) executeTask(ctx context.Context, rt *runningTask) {
rt.Lock()
if err != nil {
log.Errorf("err: %+v", err)
et.Status.Phase = types.ExecutorTaskPhaseFailed
if rt.et.Spec.Stop {
et.Status.Phase = types.ExecutorTaskPhaseStopped
} else {
et.Status.Phase = types.ExecutorTaskPhaseFailed
}
} else {
et.Status.Phase = types.ExecutorTaskPhaseSuccess
}
@ -951,7 +955,11 @@ func (e *Executor) executeTaskSteps(ctx context.Context, rt *runningTask, pod dr
}
serr = errors.Errorf("failed to execute step %s: %w", util.Dump(step), err)
} else if exitCode != 0 {
rt.et.Status.Steps[i].Phase = types.ExecutorTaskPhaseFailed
if rt.et.Spec.Stop {
rt.et.Status.Steps[i].Phase = types.ExecutorTaskPhaseStopped
} else {
rt.et.Status.Steps[i].Phase = types.ExecutorTaskPhaseFailed
}
rt.et.Status.Steps[i].ExitStatus = util.IntP(exitCode)
serr = errors.Errorf("step %q failed with exitcode %d", stepName, exitCode)
} else if exitCode == 0 {