Merge pull request #116 from sgotti/gateway_api_run_return_more_step_data

gateway: run api return more step data
This commit is contained in:
Simone Gotti 2019-09-17 22:59:36 +02:00 committed by GitHub
commit 9f1a3e405d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"`