Documentation ¶
Index ¶
- func AssignTasks()
- func Count(bean interface{}) int64
- func CountBuilders() int64
- func CountTasks() int64
- func DeleteBuilderByID(id int64) error
- func GetCommitOfBranch(branch string) (string, error)
- func IsErrBuilderExists(err error) bool
- func IsErrNoSuitableMatrix(err error) bool
- func IsErrRecordNotFound(err error) bool
- func MatchBuilders(os, arch string, tags []string) ([]int64, error)
- func NewBatchTasks(doerID int64, branch string) error
- func RegenerateBuilderToken(id int64) error
- func UpdateBuilderMatrices(builderID int64, matrices []*Matrix) error
- type Builder
- type ErrBuilderExists
- type ErrNoSuitableMatrix
- type Matrix
- type Task
- func (t *Task) AfterFind() (err error)
- func (t *Task) Archive() error
- func (t *Task) ArtifactName(format string) string
- func (t *Task) AssignBuilder(builderID int64) (err error)
- func (t *Task) BeforeCreate()
- func (t *Task) BuildFailed() error
- func (t *Task) BuildSucceed() error
- func (t *Task) CommitURL() string
- func (t *Task) CreatedTime() time.Time
- func (t *Task) Save() error
- func (t *Task) UpdatedTime() time.Time
- type TaskStatus
- type TrustLevel
- type User
- func GetOrCreateUserByGitHubID(oauthID, githubID, username, avatarURL string) (*User, bool, error)
- func GetOrCreateUserByOAuthID(oauthID string) (*User, bool, error)
- func GetUserByGitHubID(githubID string) (*User, error)
- func GetUserByID(id int64) (*User, error)
- func GetUserByOAuthID(oauthID string) (*User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignTasks ¶
func AssignTasks()
func CountBuilders ¶
func CountBuilders() int64
func CountTasks ¶
func CountTasks() int64
func DeleteBuilderByID ¶
TODO: delete building history and matrices
func GetCommitOfBranch ¶
func IsErrBuilderExists ¶
func IsErrNoSuitableMatrix ¶
func IsErrRecordNotFound ¶
func NewBatchTasks ¶
func RegenerateBuilderToken ¶
func UpdateBuilderMatrices ¶
Types ¶
type Builder ¶
type Builder struct { ID int64 Name string Token string `gorm:"UNIQUE"` TrustLevel TrustLevel IsIdle bool `gorm:"NOT NULL"` LastHeartBeat int64 Created int64 TaskID int64 }
func GetBuilderByID ¶
func GetBuilderByToken ¶
func ListBuilders ¶
func NewBuilder ¶
func (*Builder) BeforeCreate ¶
func (b *Builder) BeforeCreate()
func (*Builder) CreatedTime ¶
func (*Builder) UpdateMatrices ¶
type ErrBuilderExists ¶
type ErrBuilderExists struct {
Name string
}
func (ErrBuilderExists) Error ¶
func (err ErrBuilderExists) Error() string
type ErrNoSuitableMatrix ¶
func (ErrNoSuitableMatrix) Error ¶
func (err ErrNoSuitableMatrix) Error() string
type Matrix ¶
func FindMatrices ¶
type Task ¶
type Task struct { ID int64 OS string Arch string Tags string Commit string Status TaskStatus PosterID int64 Poster *User `gorm:"-"` BuilderID int64 Builder *Builder `gorm:"-"` Updated int64 Created int64 }
func GetTaskByID ¶
func ListPendingTasks ¶
func (*Task) ArtifactName ¶
func (*Task) AssignBuilder ¶
func (*Task) BeforeCreate ¶
func (t *Task) BeforeCreate()
func (*Task) BuildFailed ¶
func (*Task) BuildSucceed ¶
func (*Task) CreatedTime ¶
func (*Task) UpdatedTime ¶
type TaskStatus ¶
type TaskStatus int
const ( TASK_STATUS_PENDING TaskStatus = iota TASK_STATUS_BUILDING TASK_STATUS_UPLOADING TASK_STATUS_FAILED TASK_STATUS_SUCCEED TASK_STATUS_ARCHIVED TaskStatus = 99 )
func (TaskStatus) ToString ¶
func (s TaskStatus) ToString() string
type TrustLevel ¶
type TrustLevel int
const ( TRUST_LEVEL_UNAPPROVED TrustLevel = iota TRUST_LEVEL_APPROVED TRUST_LEVEL_OFFICIAL TrustLevel = 99 )
func ParseTrustLevel ¶
func ParseTrustLevel(n int) TrustLevel
func (TrustLevel) ToString ¶
func (l TrustLevel) ToString() string
type User ¶
type User struct { ID int64 OAuthID string `gorm:"column:oauth_id;UNIQUE"` GitHubID string `gorm:"column:github_id;UNIQUE"` Username string AvatarURL string IsAdmin bool `gorm:"NOT NULL"` Created int64 }
func GetOrCreateUserByGitHubID ¶
GetOrCreateUserByGitHubID retrieves a user based on GitHub ID, and creates a new user if does not exists. It returns true if a new user created.
func GetOrCreateUserByOAuthID ¶
GetOrCreateUserByOAuthID retrieves a user based on OAuth ID, and creates a new user if does not exists. It returns true if a new user created.
func GetUserByGitHubID ¶
func GetUserByID ¶
func GetUserByOAuthID ¶
func (*User) BeforeCreate ¶
func (u *User) BeforeCreate()
Click to show internal directories.
Click to hide internal directories.