1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

Add builds UI

This commit is contained in:
Lunny Xiao
2022-05-03 16:03:24 +08:00
committed by Jason Song
parent 7732392a96
commit 5a479bb034
23 changed files with 599 additions and 50 deletions

View File

@@ -5,13 +5,14 @@
package migrations
import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func addBotTables(x *xorm.Engine) error {
type BotRunner struct {
type BotsRunner struct {
ID int64
UUID string `xorm:"CHAR(36) UNIQUE"`
Name string `xorm:"VARCHAR(32) UNIQUE"`
@@ -24,29 +25,37 @@ func addBotTables(x *xorm.Engine) error {
Base int // 0 native 1 docker 2 virtual machine
RepoRange string // glob match which repositories could use this runner
Token string
LastOnline timeutil.TimeStamp
LastOnline timeutil.TimeStamp `xorm:"index"`
Created timeutil.TimeStamp `xorm:"created"`
}
type BotTask struct {
ID int64
UUID string `xorm:"CHAR(36)"`
RepoID int64 `xorm:"index"`
Type string `xorm:"VARCHAR(16)"` // 0 commit 1 pullrequest
Ref string
CommitSHA string
Event string
Token string // token for this task
Grant string // permissions for this task
EventPayload string `xorm:"LONGTEXT"`
RunnerID int64 `xorm:"index"`
Status int
Content string `xorm:"LONGTEXT"`
Created timeutil.TimeStamp `xorm:"created"`
StartTime timeutil.TimeStamp
EndTime timeutil.TimeStamp
Updated timeutil.TimeStamp `xorm:"updated"`
type BotsTask struct {
ID int64
Title string
UUID string `xorm:"CHAR(36)"`
Index int64 `xorm:"index unique(repo_index)"`
RepoID int64 `xorm:"index unique(repo_index)"`
TriggerUserID int64
Ref string
CommitSHA string
Event string
Token string // token for this task
Grant string // permissions for this task
EventPayload string `xorm:"LONGTEXT"`
RunnerID int64 `xorm:"index"`
Status int `xorm:"index"`
Created timeutil.TimeStamp `xorm:"created"`
StartTime timeutil.TimeStamp
EndTime timeutil.TimeStamp
Updated timeutil.TimeStamp `xorm:"updated"`
}
return x.Sync2(new(BotRunner), new(BotTask))
type Repository struct {
NumBuilds int `xorm:"NOT NULL DEFAULT 0"`
NumClosedBuilds int `xorm:"NOT NULL DEFAULT 0"`
}
type BuildIndex db.ResourceIndex
return x.Sync2(new(BotsRunner), new(BotsTask), new(Repository), new(BuildIndex))
}