2015-04-07 08:20:55 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
const (
|
|
|
|
StatePending = "pending"
|
|
|
|
StateRunning = "running"
|
|
|
|
StateSuccess = "success"
|
|
|
|
StateFailure = "failure"
|
|
|
|
StateKilled = "killed"
|
|
|
|
StateError = "error"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Build struct {
|
|
|
|
Number int `json:"number"`
|
|
|
|
State string `json:"state"`
|
|
|
|
Duration int64 `json:"duration"`
|
|
|
|
Started int64 `json:"started_at"`
|
|
|
|
Finished int64 `json:"finished_at"`
|
|
|
|
Created int64 `json:"created_at"`
|
|
|
|
Updated int64 `json:"updated_at"`
|
|
|
|
|
2015-04-16 06:45:24 +00:00
|
|
|
// Tasks int `json:"task_count"`
|
|
|
|
|
2015-04-07 08:20:55 +00:00
|
|
|
// Commit represents the commit data send in the
|
|
|
|
// post-commit hook. This will not be populated when
|
|
|
|
// a pull requests.
|
|
|
|
Commit *Commit `json:"head_commit,omitempty"`
|
|
|
|
|
|
|
|
// PullRequest represents the pull request data sent
|
|
|
|
// in the post-commit hook. This will only be populated
|
|
|
|
// when a pull request.
|
|
|
|
PullRequest *PullRequest `json:"pull_request,omitempty"`
|
2015-04-16 06:45:24 +00:00
|
|
|
|
|
|
|
// Statuses represents a list of build statuses used
|
|
|
|
// to annotate the build.
|
|
|
|
Statuses []*Status `json:"statuses,omitempty"`
|
|
|
|
|
|
|
|
// Tasks represents a list of build tasks. A build is
|
|
|
|
// comprised of one or many tasks.
|
|
|
|
Tasks []*Task `json:"tasks,omitempty"`
|
2015-04-07 08:20:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Status struct {
|
|
|
|
State string `json:"state"`
|
|
|
|
Link string `json:"target_url"`
|
|
|
|
Desc string `json:"description"`
|
|
|
|
Context string `json:"context"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Commit struct {
|
|
|
|
Sha string `json:"sha,omitempty"`
|
|
|
|
Ref string `json:"ref,omitempty"`
|
|
|
|
Message string `json:"message,omitempty"`
|
|
|
|
Timestamp string `json:"timestamp,omitempty"`
|
|
|
|
Author *Author `json:"author,omitempty"`
|
|
|
|
Remote *Remote `json:"repo,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PullRequest struct {
|
|
|
|
Number int `json:"number,omitempty"`
|
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
Source *Commit `json:"source,omitempty"`
|
|
|
|
Target *Commit `json:"target,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Author struct {
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Login string `json:"login,omitempty"`
|
|
|
|
Email string `json:"email,omitempty"`
|
|
|
|
Gravatar string `json:"gravatar_id,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Remote struct {
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
FullName string `json:"full_name,omitempty"`
|
|
|
|
Clone string `json:"clone_url,omitempty"`
|
|
|
|
}
|
2015-04-16 07:10:17 +00:00
|
|
|
|
|
|
|
type Clone struct {
|
|
|
|
Origin string `json:"origin"`
|
|
|
|
Remote string `json:"remote"`
|
|
|
|
Branch string `json:"branch"`
|
|
|
|
Sha string `json:"sha"`
|
|
|
|
Ref string `json:"ref"`
|
|
|
|
Dir string `json:"dir"`
|
|
|
|
Netrc *Netrc `json:"netrc"`
|
|
|
|
Keypair *Keypair `json:"keypair"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Netrc struct {
|
|
|
|
Machine string `json:"machine"`
|
|
|
|
Login string `json:"login"`
|
|
|
|
Password string `json:"user"`
|
|
|
|
}
|