Merge pull request #115 from sgotti/runservice_save_run_exitstatus

runservice: save step exitstatus in run.
This commit is contained in:
Simone Gotti 2019-09-17 16:47:51 +02:00 committed by GitHub
commit 99d137d9eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) serr = errors.Errorf("failed to execute step %s: %w", util.Dump(step), err)
} else if exitCode != 0 { } else if exitCode != 0 {
rt.et.Status.Steps[i].Phase = types.ExecutorTaskPhaseFailed 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) 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 { 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 { for i, s := range et.Status.Steps {
rt.Steps[i].Phase = s.Phase rt.Steps[i].Phase = s.Phase
rt.Steps[i].ExitStatus = s.ExitStatus
rt.Steps[i].StartTime = s.StartTime rt.Steps[i].StartTime = s.StartTime
rt.Steps[i].EndTime = s.EndTime rt.Steps[i].EndTime = s.EndTime
} }

View File

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