diff --git a/go.mod b/go.mod index d9f7ea4..b0f697a 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-chi/chi/v5 v5.0.3 github.com/go-chi/jwtauth/v5 v5.0.1 github.com/gofrs/uuid v4.0.0+incompatible - github.com/joho/godotenv v1.4.0 // indirect + github.com/joho/godotenv v1.4.0 github.com/json-iterator/go v1.1.9 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/kr/pretty v0.2.1 // indirect diff --git a/server/server.go b/server/server.go index 4063016..02a7dfd 100644 --- a/server/server.go +++ b/server/server.go @@ -164,6 +164,8 @@ type taskResult struct { // Task name // example: task_name Name string `json:"name"` + // Task names this task depends on + DependsOn []string `json:"dependsOn,omitempty"` // Status of task // enum: waiting,running,skipped,done,error,canceled Status string `json:"status"` @@ -221,14 +223,15 @@ func jobToResult(j *prunner.PipelineJob) pipelineJobResult { errored := false for _, t := range j.Tasks { res := taskResult{ - Name: t.Name, - Status: t.Status, - Start: t.Start, - End: t.End, - Skipped: t.Skipped, - ExitCode: t.ExitCode, - Errored: t.Errored, - Error: helper.ErrToStrPtr(t.Error), + Name: t.Name, + DependsOn: t.DependsOn, + Status: t.Status, + Start: t.Start, + End: t.End, + Skipped: t.Skipped, + ExitCode: t.ExitCode, + Errored: t.Errored, + Error: helper.ErrToStrPtr(t.Error), } taskResults = append(taskResults, res) // Collect if job had a errored task diff --git a/server/swagger.yml b/server/swagger.yml index 0947f3e..ff14cc2 100644 --- a/server/swagger.yml +++ b/server/swagger.yml @@ -88,6 +88,12 @@ definitions: x-go-package: github.com/Flowpack/prunner/server task: properties: + dependsOn: + description: Task names this task depends on + items: + type: string + type: array + x-go-name: DependsOn end: description: When the task was finished format: date-time