Skip to content

Commit

Permalink
Merge pull request agola-io#115 from sgotti/runservice_save_run_exits…
Browse files Browse the repository at this point in the history
…tatus

runservice: save step exitstatus in run.
  • Loading branch information
sgotti authored Sep 17, 2019
2 parents efa71b5 + ff38096 commit 15b9218
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/services/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions internal/services/runservice/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion services/runservice/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 15b9218

Please sign in to comment.