Documentation ¶
Index ¶
- Constants
- Variables
- type Build
- type Commit
- func (c *Commit) CreatedString() string
- func (c *Commit) FinishedString() string
- func (c *Commit) HashShort() string
- func (c *Commit) Image() string
- func (c *Commit) ImageLarge() string
- func (c *Commit) ImageSmall() string
- func (c *Commit) SetAuthor(email string)
- func (c *Commit) StartedString() string
- type Member
- type Repo
- type RepoCommit
- type Role
- type Settings
- type Team
- type User
Constants ¶
const ( StatusNone = "None" StatusEnqueue = "Pending" StatusStarted = "Started" StatusSuccess = "Success" StatusFailure = "Failure" StatusError = "Error" )
const ( // Owners can add / remove team members, create / delete projects, // and have rwx access to all projects owned by the team. RoleOwner = "Owner" // Admins can create / delete projects and have rwx acess // to all projects owned by the team. RoleAdmin = "Admin" // Write members have rwx access to all projects // owned by the team. They may not create new projects. RoleWrite = "Write" // Read members have readonly access to all projects // owned by the team. RoleRead = "Read" )
const ( ScmGit = "git" ScmHg = "hg" ScmSvn = "svn" )
const ( HostBitbucket = "bitbucket.org" HostGoogle = "code.google.com" HostCustom = "custom" )
const ( DefaultBranchGit = "master" DefaultBranchHg = "default" DefaultBranchSvn = "trunk" )
const ( RSA_BITS = 2048 // Default number of bits in an RSA key RSA_BITS_MIN = 768 // Minimum number of bits in an RSA key )
Variables ¶
var ( ErrInvalidGitHubTrailingSlash = errors.New("GitHub URL should not have a trailing slash") ErrInvalidSmtpAddress = errors.New("SMTP From Address must be provided") ErrInvalidSmtpPort = errors.New("SMTP Port must be provided") )
var ( ErrInvalidUserName = errors.New("Invalid User Name") ErrInvalidPassword = errors.New("Invalid Password") ErrInvalidEmail = errors.New("Invalid Email Address") )
var ErrInvalidTeamName = errors.New("Invalid Team Name")
ErrInvalidTeamName is returned by the Team validation function when a team name is invalid.
var GravatarPattern = "https://gravatar.com/avatar/%s?s=%v&d=identicon"
Gravatar URL pattern
var RegexpEmail = regexp.MustCompile(`^[^@]+@[^@.]+\.[^@.]+`)
Simple regular expression used to verify that an email address matches the expected standard format.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct { ID int64 `meddler:"id,pk" json:"id"` CommitID int64 `meddler:"commit_id" json:"-"` Slug string `meddler:"slug" json:"slug"` Status string `meddler:"status" json:"status"` Started time.Time `meddler:"started,utctime" json:"started"` Finished time.Time `meddler:"finished,utctime" json:"finished"` Duration int64 `meddler:"duration" json:"duration"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` Stdout string `meddler:"stdout" json:"-"` }
func (*Build) FinishedString ¶
Returns the Started Date as an ISO8601 formatted string.
func (*Build) HumanDuration ¶
HumanDuration returns a human-readable approximation of a duration (eg. "About a minute", "4 hours ago", etc.)
func (*Build) IsRunning ¶
Returns true if the Build statis is Started or Pending, indicating it is currently running.
func (*Build) StartedString ¶
Returns the Started Date as an ISO8601 formatted string.
type Commit ¶
type Commit struct { ID int64 `meddler:"id,pk" json:"id"` RepoID int64 `meddler:"repo_id" json:"-"` Status string `meddler:"status" json:"status"` Started time.Time `meddler:"started,utctime" json:"started"` Finished time.Time `meddler:"finished,utctime" json:"finished"` Duration int64 `meddler:"duration" json:"duration"` Hash string `meddler:"hash" json:"hash"` Branch string `meddler:"branch" json:"branch"` PullRequest string `meddler:"pull_request" json:"pull_request"` Author string `meddler:"author" json:"author"` Gravatar string `meddler:"gravatar" json:"gravatar"` Timestamp string `meddler:"timestamp" json:"timestamp"` Message string `meddler:"message" json:"message"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` }
func (*Commit) CreatedString ¶
Returns the Created Date as an ISO8601 formatted string.
func (*Commit) FinishedString ¶
Returns the Started Date as an ISO8601 formatted string.
func (*Commit) ImageLarge ¶
func (*Commit) ImageSmall ¶
func (*Commit) StartedString ¶
Returns the Started Date as an ISO8601 formatted string.
type Member ¶
type Member struct { ID int64 `meddler:"user_id"` Name string `meddler:"name"` Email string `meddler:"email"` Gravatar string `meddler:"gravatar"` Role string `meddler:"role"` }
func (*Member) ImageLarge ¶
func (*Member) ImageSmall ¶
type Repo ¶
type Repo struct { ID int64 `meddler:"id,pk" json:"id"` // the full, canonical name of the repository, for example: // github.com/bradrydzewski/go.stripe Slug string `meddler:"slug" json:"slug"` // the hosting service where the repository is stored, // such as github.com, bitbucket.org, etc Host string `meddler:"host" json:"host"` // the owner of the repository on the host system. // for example, the Github username. Owner string `meddler:"owner" json:"owner"` // URL-friendly version of a repository name on the // host system. Name string `meddler:"name" json:"name"` // A value of True indicates the repository is closed source, // while a value of False indicates the project is open source. Private bool `meddler:"private" json:"private"` // A value of True indicates the repository is disabled and // no builds should be executed Disabled bool `meddler:"disabled" json:"disabled"` // A value of True indicates that pull requests are disabled // for the repository and no builds will be executed DisabledPullRequest bool `meddler:"disabled_pr" json:"disabled_pr"` // indicates the type of repository, such as // Git, Mercurial, Subversion or Bazaar. SCM string `meddler:"scm" json:"scm"` // the repository URL, for example: // git://github.com/bradrydzewski/go.stripe.git URL string `meddler:"url" json:"url"` // username and password requires to authenticate // to the repository Username string `meddler:"username" json:"username"` Password string `meddler:"password" json:"password"` // RSA key pair that will injected into the virtual machine // .ssh/id_rsa and .ssh/id_rsa.pub files. PublicKey string `meddler:"public_key" json:"public_key"` PrivateKey string `meddler:"private_key" json:"public_key"` // Parameters stored external to the repository in YAML // format, injected into the Build YAML at runtime. Params map[string]string `meddler:"params,gob" json:"-"` // the amount of time, in seconds the build will execute // before exceeding its timelimit and being killed. Timeout int64 `meddler:"timeout" json:"timeout"` // Indicates the build should be executed in privileged // mode. This could, for example, be used to run Docker in Docker. Privileged bool `meddler:"privileged" json:"privileged"` // Foreign keys signify the User that created // the repository and team account linked to // the repository. UserID int64 `meddler:"user_id" json:"user_id"` TeamID int64 `meddler:"team_id" json:"team_id"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` }
func NewBitbucketRepo ¶
Creates a new Bitbucket repository
func NewGitHubRepo ¶
Creates a new GitHub repository
func (*Repo) DefaultBranch ¶
type RepoCommit ¶
type RepoCommit struct { // Repo Details Slug string `meddler:"slug" json:"slug"` Host string `meddler:"host" json:"host"` Owner string `meddler:"owner" json:"owner"` Name string `meddler:"name" json:"name"` // Commit Details Status string `meddler:"status" json:"status"` Started time.Time `meddler:"started,utctime" json:"started"` Finished time.Time `meddler:"finished,utctime" json:"finished"` Duration int64 `meddler:"duration" json:"duration"` Hash string `meddler:"hash" json:"hash"` Branch string `meddler:"branch" json:"branch"` PullRequest string `meddler:"pull_request" json:"pull_request"` Author string `meddler:"author" json:"author"` Gravatar string `meddler:"gravatar" json:"gravatar"` Timestamp string `meddler:"timestamp" json:"timestamp"` Message string `meddler:"message" json:"message"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` }
Combined Repository and Commit details
func (*RepoCommit) CreatedString ¶
func (c *RepoCommit) CreatedString() string
Returns the Created Date as an ISO8601 formatted string.
func (*RepoCommit) FinishedString ¶
func (c *RepoCommit) FinishedString() string
Returns the Started Date as an ISO8601 formatted string.
func (*RepoCommit) HashShort ¶
func (c *RepoCommit) HashShort() string
Returns the Short (--short) Commit Hash.
func (*RepoCommit) ImageLarge ¶
func (c *RepoCommit) ImageLarge() string
func (*RepoCommit) ImageSmall ¶
func (c *RepoCommit) ImageSmall() string
func (*RepoCommit) StartedString ¶
func (c *RepoCommit) StartedString() string
Returns the Started Date as an ISO8601 formatted string.
type Settings ¶
type Settings struct { ID int64 `meddler:"id,pk"` // SMTP settings. SmtpServer string `meddler:"smtp_server"` SmtpPort string `meddler:"smtp_port"` SmtpAddress string `meddler:"smtp_address"` SmtpUsername string `meddler:"smtp_username"` SmtpPassword string `meddler:"smtp_password"` // GitHub Consumer key and secret. GitHubKey string `meddler:"github_key"` GitHubSecret string `meddler:"github_secret"` GitHubDomain string `meddler:"github_domain"` GitHubApiUrl string `meddler:"github_apiurl"` // Bitbucket Consumer Key and secret. BitbucketKey string `meddler:"bitbucket_key"` BitbucketSecret string `meddler:"bitbucket_secret"` // Domain of the server, eg drone.io Domain string `meddler:"hostname"` // Scheme of the server, eg https Scheme string `meddler:"scheme"` OpenInvitations bool `meddler:"open_invitations"` }
type Team ¶
type Team struct { ID int64 `meddler:"id,pk" json:"id"` Slug string `meddler:"slug" json:"slug"` Name string `meddler:"name" json:"name"` Email string `meddler:"email" json:"email"` Gravatar string `meddler:"gravatar" json:"gravatar"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` }
func (*Team) ImageLarge ¶
func (*Team) ImageSmall ¶
type User ¶
type User struct { ID int64 `meddler:"id,pk" json:"id"` Email string `meddler:"email" json:"email"` Password string `meddler:"password" json:"-"` Token string `meddler:"token" json:"-"` Name string `meddler:"name" json:"name"` Gravatar string `meddler:"gravatar" json:"gravatar"` Created time.Time `meddler:"created,utctime" json:"created"` Updated time.Time `meddler:"updated,utctime" json:"updated"` Admin bool `meddler:"admin" json:"-"` // GitHub OAuth2 token for accessing public repositories. GithubLogin string `meddler:"github_login" json:"-"` GithubToken string `meddler:"github_token" json:"-"` // Bitbucket OAuth1.0a token and token secret. BitbucketLogin string `meddler:"bitbucket_login" json:"-"` BitbucketToken string `meddler:"bitbucket_token" json:"-"` BitbucketSecret string `meddler:"bitbucket_secret" json:"-"` }
func (*User) ComparePassword ¶
ComparePassword compares the supplied password to the user password stored in the database.
func (*User) ImageLarge ¶
func (*User) ImageSmall ¶
func (*User) SetPassword ¶
Set the password and hash with bcrypt