runservice: save step exitstatus in run.

For every step save also the command exit status.
This commit is contained in:
Simone Gotti 2019-09-16 16:06:26 +02:00
parent 25c5002782
commit 39829f1ec4
3 changed files with 7 additions and 2 deletions

View File

@ -983,8 +983,10 @@ 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
rt.et.Status.Steps[i].ExitCode = exitCode
rt.et.Status.Steps[i].ExitStatus = util.IntP(exitCode)
serr = errors.Errorf("step %q failed with exitcode %d", stepName, exitCode)
} else if exitCode == 0 {
rt.et.Status.Steps[i].ExitStatus = util.IntP(exitCode)
}
if err := e.sendExecutorTaskStatus(ctx, rt.et); err != nil {

View File

@ -688,6 +688,7 @@ func (s *Runservice) updateRunTaskStatus(ctx context.Context, et *types.Executor
for i, s := range et.Status.Steps {
rt.Steps[i].Phase = s.Phase
rt.Steps[i].ExitStatus = s.ExitStatus
rt.Steps[i].StartTime = s.StartTime
rt.Steps[i].EndTime = s.EndTime
}

View File

@ -277,6 +277,8 @@ type RunTaskStep struct {
// one logphase for every task step
LogPhase RunTaskFetchPhase `json:"log_phase,omitempty"`
ExitStatus *int `json:"exit_status"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
}
@ -532,7 +534,7 @@ type ExecutorTaskStepStatus struct {
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
ExitStatus *int `json:"exit_status,omitempty"`
}
type Container struct {