gateway api: return if run is stopping

This commit is contained in:
Simone Gotti 2019-05-15 14:49:46 +02:00
parent bda7a3eb8b
commit e2bee03a06
1 changed files with 10 additions and 7 deletions

View File

@ -54,6 +54,7 @@ type RunResponse struct {
Phase rstypes.RunPhase `json:"phase"` Phase rstypes.RunPhase `json:"phase"`
Result rstypes.RunResult `json:"result"` Result rstypes.RunResult `json:"result"`
SetupErrors []string `json:"setup_errors"` SetupErrors []string `json:"setup_errors"`
Stopping bool `json:"stopping"`
Tasks map[string]*RunResponseTask `json:"tasks"` Tasks map[string]*RunResponseTask `json:"tasks"`
TasksWaitingApproval []string `json:"tasks_waiting_approval"` TasksWaitingApproval []string `json:"tasks_waiting_approval"`
@ -116,13 +117,15 @@ type RunTaskResponseStep struct {
func createRunResponse(r *rstypes.Run, rc *rstypes.RunConfig) *RunResponse { func createRunResponse(r *rstypes.Run, rc *rstypes.RunConfig) *RunResponse {
run := &RunResponse{ run := &RunResponse{
ID: r.ID, ID: r.ID,
Counter: r.Counter, Counter: r.Counter,
Name: r.Name, Name: r.Name,
Annotations: r.Annotations, Annotations: r.Annotations,
Phase: r.Phase, Phase: r.Phase,
Result: r.Result, Result: r.Result,
SetupErrors: rc.SetupErrors, Stopping: r.Stop,
SetupErrors: rc.SetupErrors,
Tasks: make(map[string]*RunResponseTask), Tasks: make(map[string]*RunResponseTask),
TasksWaitingApproval: r.TasksWaitingApproval(), TasksWaitingApproval: r.TasksWaitingApproval(),