Documentation ¶
Index ¶
- Constants
- func AddBuild(projectName string, branch string, commit string, commitTime time.Time, ...) error
- func AddBuildWithProject(project Project) error
- func AddGithubBuild(projectId int64, data githubutil.GithubPushHook) error
- func AddGitlabBuild(projectId int64, data gitlabutil.GitlabPushHook) error
- func AddProject(project Project) error
- func ReadOrCreateProject(userName string, projectName string, repoUrl string) (int64, error)
- func RegisterModels()
- type Build
- type Project
- type Worker
Constants ¶
const ( BUILD_STATUS_NOT_START = 0 BUILD_STATUS_BUILDING = 1 BUILD_STATUS_SUCCESS = 2 BUILD_STATUS_FAIL = 3 BUILD_STATUS_CANCELED = 4 )
const ( PROJECT_STATUS_NEED_TEST = 0 PROJECT_STATUS_TESTING = 1 PROJECT_STATUS_SUCCESS = 2 PROJECT_STATUS_FAIL = 3 )
const ( WORKER_STATUS_IDLE = 0 WORKER_STATUS_BUSY = 1 WORKER_STATUS_DIE = 2 )
Variables ¶
This section is empty.
Functions ¶
func AddBuild ¶
func AddBuild(projectName string, branch string, commit string, commitTime time.Time, committer string) error
AddBuild takes basic information to create build.
func AddBuildWithProject ¶
AddBuildWithProject take project object to create build.
func AddGithubBuild ¶
func AddGithubBuild(projectId int64, data githubutil.GithubPushHook) error
AddGithubBuild takes github webhook to create build.
func AddGitlabBuild ¶
func AddGitlabBuild(projectId int64, data gitlabutil.GitlabPushHook) error
AddGitlabBuild takes gitlab webhook to create build.
func ReadOrCreateProject ¶
ReadOrCreateProject tries to get the project and create it if it doesn't exist.
Types ¶
type Build ¶
type Build struct { Id int64 `orm:"pk;auto"` ProjectId int64 UserName string `orm:"size(1024);null"` ProjectName string `orm:"size(1024);null"` RepoUrl string `orm:"size(1024);null"` Branch string `orm:"size(1024);null"` Commit string `orm:"size(1024);null"` CommitTime time.Time `orm:"null"` Committer string `orm:"size(1024);null"` BuildTime time.Time `orm:"null"` FinishTime time.Time `orm:"null"` Worker string `orm:"size(1024);null"` Status int `orm:"null"` }
Build contains all the information of the build task.
func GetBuildWithId ¶
GetBuildWithId takes build is and return the build.
func GetBuildsWithProjectName ¶
GetBuildsWithProjectName takes project name and return its builds.
type Project ¶
type Project struct { Id int64 `orm:"pk;auto"` UserName string `orm:"size(1024);null"` ProjectName string `orm:"size(1024);null"` RepoUrl string `orm:"size(1024);null"` Status int `orm:"null"` }
Project contains all the information of project.
func GetAllProjects ¶
func GetAllProjects() []*Project
GetAllProjects return all projects from database.
func GetProjectWithId ¶
GetProjectWithId takes id to return the project.
type Worker ¶
type Worker struct { Id int64 `orm:"pk;auto"` Ip string `orm:"size(1024)"` LastUpdate time.Time Status int }
Worker contains all the information of the worker.
func GetAllWorkers ¶
func GetAllWorkers() []*Worker
GetAllWorkers return all the workers from database.
func GetAllWorkersWithStatus ¶
GetAllWorkersWithStatus takes the status and return the workers.