fix(backend): job model wasn't reflecting the nullable fields
ci-agent / build (push) Failing after 5m6s

This commit is contained in:
2026-04-05 05:05:34 +03:00
parent 71a8fa154b
commit 2616669ab1
2 changed files with 17 additions and 12 deletions
+7 -7
View File
@@ -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.Status != 0 || job.Stdout != "" || job.Stderr != "" {
if job.Status != nil || job.Stdout != nil || job.Stderr != nil {
c.JSON(http.StatusOK, JobResult{
ID: job.ID,
Command: job.Command,
Stdin: job.Stdin,
Stdout: job.Stdout,
Stderr: job.Stderr,
Status: job.Status,
Stdout: *job.Stdout,
Stderr: *job.Stderr,
Status: *job.Status,
})
return
}
@@ -173,9 +173,9 @@ func (h *JobsHandlers) WaitJob(c *gin.Context) {
ID: ajob.ID,
Command: ajob.Command,
Stdin: ajob.Stdin,
Stdout: ajob.Stdout,
Stderr: ajob.Stderr,
Status: ajob.Status,
Stdout: *ajob.Stdout,
Stderr: *ajob.Stderr,
Status: *ajob.Status,
})
}
+10 -5
View File
@@ -1,10 +1,8 @@
package models
type Job struct {
ID int64
AgentID string
JobForInsert
JobForUpdate
type JobBase struct {
ID int64
AgentID string
}
type JobForInsert struct {
Command []string
@@ -15,3 +13,10 @@ type JobForUpdate struct {
Stderr string
Status int32
}
type Job struct {
JobBase
JobForInsert
Stdout *string
Stderr *string
Status *int32
}