diff --git a/server/core/job.go b/server/core/job.go index d6f5c593..be509a0b 100644 --- a/server/core/job.go +++ b/server/core/job.go @@ -19,6 +19,7 @@ type ( Build *Build `gorm:"preload:false" json:"build,omitempty"` BuildID uint `json:"buildID"` Timestamp + AssignedWorker string `json:"assignedWorker"` } // JobStore defines operations for working with jobs database table. diff --git a/server/scheduler/scheduler.go b/server/scheduler/scheduler.go index f2eb1065..8ea3c297 100644 --- a/server/scheduler/scheduler.go +++ b/server/scheduler/scheduler.go @@ -75,6 +75,7 @@ func (s *scheduler) Next(job *core.Job) error { job.Log = "" job.StartTime = nil job.EndTime = nil + job.AssignedWorker = "" if err := s.saveJob(job); err != nil { s.logger.Errorf("error saving job %d: %v", job.ID, err.Error()) } @@ -282,6 +283,7 @@ func (s *scheduler) startJob(job *core.Job, worker *core.Worker) { job.Log = "" job.StartTime = lib.TimeNow() job.EndTime = nil + job.AssignedWorker = worker.Host.Hostname if err := s.saveJob(job); err != nil { s.logger.Errorf("error saving job %d: %v", job.ID, err.Error()) } diff --git a/server/store/job/job.go b/server/store/job/job.go index d8a8fe73..cb90bf79 100644 --- a/server/store/job/job.go +++ b/server/store/job/job.go @@ -53,10 +53,11 @@ func (s jobStore) Update(job *core.Job) error { log := []byte(job.Log) err := s.db.Model(job).Updates(map[string]interface{}{ - "status": job.Status, - "start_time": job.StartTime, - "end_time": job.EndTime, - "log": job.Log, + "status": job.Status, + "start_time": job.StartTime, + "end_time": job.EndTime, + "log": job.Log, + "assignedWorker": job.AssignedWorker, }).Error if err == nil { diff --git a/web/abstruse/src/app/builds/job/job.component.html b/web/abstruse/src/app/builds/job/job.component.html index a962387d..50b1a88b 100644 --- a/web/abstruse/src/app/builds/job/job.component.html +++ b/web/abstruse/src/app/builds/job/job.component.html @@ -15,6 +15,7 @@

Job #{{ job?.id }}

+

Worker: {{ job?.assignedWorker }}