Skip to content

Commit

Permalink
Expose task dependencies in API
Browse files Browse the repository at this point in the history
  • Loading branch information
hlubek committed Oct 12, 2021
1 parent 1caa640 commit c98bd10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions server/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c98bd10

Please sign in to comment.