gateway: run api return more step data

For every step return the step type.

For a run step also return the shell and exit status.
This commit is contained in:
Simone Gotti 2019-09-11 14:38:50 +02:00
parent 99d137d9eb
commit 9cfb21d365
2 changed files with 19 additions and 0 deletions

View File

@ -110,17 +110,32 @@ func createRunTaskResponse(rt *rstypes.RunTask, rct *rstypes.RunConfigTask) *gwa
EndTime: rt.Steps[i].EndTime,
}
rcts := rct.Steps[i]
rts := rt.Steps[i]
switch rcts := rcts.(type) {
case *rstypes.RunStep:
s.Type = "run"
s.Name = rcts.Name
s.Command = rcts.Command
shell := rcts.Shell
if shell == "" {
shell = rct.Shell
}
s.Shell = shell
s.ExitStatus = rts.ExitStatus
case *rstypes.SaveToWorkspaceStep:
s.Type = "save_to_workspace"
s.Name = "save to workspace"
case *rstypes.RestoreWorkspaceStep:
s.Type = "restore_workspace"
s.Name = "restore workspace"
case *rstypes.SaveCacheStep:
s.Type = "save_cache"
s.Name = "save cache"
case *rstypes.RestoreCacheStep:
s.Type = "restore_cache"
s.Name = "restore cache"
}

View File

@ -97,8 +97,12 @@ type RunTaskResponseSetupStep struct {
type RunTaskResponseStep struct {
Phase rstypes.ExecutorTaskPhase `json:"phase"`
Type string `json:"type"`
Name string `json:"name"`
Command string `json:"command"`
Shell string `json:"shell"`
ExitStatus *int `json:"exit_status"`
StartTime *time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time"`