Skip to content

Commit

Permalink
add duration, links to #45 but doesnt expose it in the UI yet
Browse files Browse the repository at this point in the history
  • Loading branch information
bart6114 committed Oct 25, 2023
1 parent c6d0eb7 commit d288d15
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ type JobSpec struct {
type JobRun struct {
Status int `json:"status"`
logBuf bytes.Buffer
Log string `json:"log"`
Name string `json:"name"`
TriggeredAt time.Time `json:"triggered_at"`
TriggeredBy string `json:"triggered_by"`
Triggered []string `json:"triggered,omitempty"`
Log string `json:"log"`
Name string `json:"name"`
TriggeredAt time.Time `json:"triggered_at"`
TriggeredBy string `json:"triggered_by"`
Triggered []string `json:"triggered,omitempty"`
Duration time.Duration `json:"duration,omitempty"`
jobRef *JobSpec
}

Expand Down Expand Up @@ -187,6 +188,7 @@ func (j *JobSpec) execCommand(trigger string) JobRun {
return jr
}

jr.Duration = time.Since(jr.TriggeredAt)
jr.Status = 0
j.log.Debug().Str("job", j.Name).Int("exitcode", jr.Status).Msgf("job exited status: %v", jr.Status)

Expand Down

0 comments on commit d288d15

Please sign in to comment.