feat: inner build view UI

This commit is contained in:
Jason Song
2022-10-21 17:27:07 +08:00
parent d6e100f6be
commit dee4f2470b
9 changed files with 102 additions and 122 deletions

View File

@@ -84,11 +84,15 @@ func (run *Run) LoadAttributes(ctx context.Context) error {
}
func (run *Run) TakeTime() time.Duration {
if run.Started == 0 {
return 0
}
started := run.Started.AsTime()
if run.Status.IsDone() {
return run.Stopped.AsTime().Sub(started)
}
return time.Since(started)
run.Stopped.AsTime().Sub(started)
return time.Since(started).Truncate(time.Second)
}
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {

View File

@@ -259,6 +259,14 @@ func CreateTaskForRunner(runner *Runner) (*Task, bool, error) {
return nil, false, err
}
if job.Run.Status.IsWaiting() {
job.Run.Status = StatusRunning
job.Run.Started = now
if err := UpdateRun(ctx, job.Run, "status", "started"); err != nil {
return nil, false, err
}
}
task.Job = job
if err := commiter.Commit(); err != nil {