fix(backend): job model wasn't reflecting the nullable fields
ci-agent / build (push) Failing after 5m6s
ci-agent / build (push) Failing after 5m6s
This commit is contained in:
@@ -144,14 +144,14 @@ func (h *JobsHandlers) WaitJob(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If job is already completed (has output or non-zero status), return immediately
|
// If job is already completed (has output or non-zero status), return immediately
|
||||||
if job.Status != 0 || job.Stdout != "" || job.Stderr != "" {
|
if job.Status != nil || job.Stdout != nil || job.Stderr != nil {
|
||||||
c.JSON(http.StatusOK, JobResult{
|
c.JSON(http.StatusOK, JobResult{
|
||||||
ID: job.ID,
|
ID: job.ID,
|
||||||
Command: job.Command,
|
Command: job.Command,
|
||||||
Stdin: job.Stdin,
|
Stdin: job.Stdin,
|
||||||
Stdout: job.Stdout,
|
Stdout: *job.Stdout,
|
||||||
Stderr: job.Stderr,
|
Stderr: *job.Stderr,
|
||||||
Status: job.Status,
|
Status: *job.Status,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -173,9 +173,9 @@ func (h *JobsHandlers) WaitJob(c *gin.Context) {
|
|||||||
ID: ajob.ID,
|
ID: ajob.ID,
|
||||||
Command: ajob.Command,
|
Command: ajob.Command,
|
||||||
Stdin: ajob.Stdin,
|
Stdin: ajob.Stdin,
|
||||||
Stdout: ajob.Stdout,
|
Stdout: *ajob.Stdout,
|
||||||
Stderr: ajob.Stderr,
|
Stderr: *ajob.Stderr,
|
||||||
Status: ajob.Status,
|
Status: *ajob.Status,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Job struct {
|
type JobBase struct {
|
||||||
ID int64
|
ID int64
|
||||||
AgentID string
|
AgentID string
|
||||||
JobForInsert
|
|
||||||
JobForUpdate
|
|
||||||
}
|
}
|
||||||
type JobForInsert struct {
|
type JobForInsert struct {
|
||||||
Command []string
|
Command []string
|
||||||
@@ -15,3 +13,10 @@ type JobForUpdate struct {
|
|||||||
Stderr string
|
Stderr string
|
||||||
Status int32
|
Status int32
|
||||||
}
|
}
|
||||||
|
type Job struct {
|
||||||
|
JobBase
|
||||||
|
JobForInsert
|
||||||
|
Stdout *string
|
||||||
|
Stderr *string
|
||||||
|
Status *int32
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user