Documentation
¶
Index ¶
- Constants
- func ParseRepo(str string) (user, repo string, err error)
- func WithTaskStore(q queue.Queue, s TaskStore) queue.Queue
- type Build
- type CCProject
- type CCProjects
- type Config
- type ConfigStore
- type Environ
- type EnvironService
- type EnvironStore
- type Event
- type EventType
- type Feed
- type File
- type FileStore
- type Limiter
- type Netrc
- type NoLimit
- type Perm
- type PermStore
- type Proc
- type ProcStore
- type Registry
- type RegistryService
- type RegistryStore
- type Repo
- type RepoLite
- type RepoPatch
- type ResourceLimit
- type Secret
- type SecretService
- type SecretStore
- type Sender
- type SenderService
- type SenderStore
- type Settings
- type Task
- type TaskStore
- type Team
- type User
Constants ¶
const ( EventPush = "push" EventPull = "pull_request" EventTag = "tag" EventDeploy = "deployment" )
const ( StatusSkipped = "skipped" StatusPending = "pending" StatusRunning = "running" StatusSuccess = "success" StatusFailure = "failure" StatusKilled = "killed" StatusError = "error" StatusBlocked = "blocked" StatusDeclined = "declined" )
const ( RepoGit = "git" RepoHg = "hg" RepoFossil = "fossil" RepoPerforce = "perforce" )
const ( VisibilityPublic = "public" VisibilityPrivate = "private" VisibilityInternal = "internal" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Build ¶
type Build struct {
ID int64 `json:"id" meddler:"build_id,pk"`
RepoID int64 `json:"-" meddler:"build_repo_id"`
ConfigID int64 `json:"-" meddler:"build_config_id"`
Number int `json:"number" meddler:"build_number"`
Parent int `json:"parent" meddler:"build_parent"`
Event string `json:"event" meddler:"build_event"`
Status string `json:"status" meddler:"build_status"`
Error string `json:"error" meddler:"build_error"`
Enqueued int64 `json:"enqueued_at" meddler:"build_enqueued"`
Created int64 `json:"created_at" meddler:"build_created"`
Started int64 `json:"started_at" meddler:"build_started"`
Finished int64 `json:"finished_at" meddler:"build_finished"`
Deploy string `json:"deploy_to" meddler:"build_deploy"`
Commit string `json:"commit" meddler:"build_commit"`
Branch string `json:"branch" meddler:"build_branch"`
Ref string `json:"ref" meddler:"build_ref"`
Refspec string `json:"refspec" meddler:"build_refspec"`
Remote string `json:"remote" meddler:"build_remote"`
Title string `json:"title" meddler:"build_title"`
Message string `json:"message" meddler:"build_message"`
Timestamp int64 `json:"timestamp" meddler:"build_timestamp"`
Sender string `json:"sender" meddler:"build_sender"`
Author string `json:"author" meddler:"build_author"`
Avatar string `json:"author_avatar" meddler:"build_avatar"`
Email string `json:"author_email" meddler:"build_email"`
Link string `json:"link_url" meddler:"build_link"`
Signed bool `json:"signed" meddler:"build_signed"` // deprecate
Verified bool `json:"verified" meddler:"build_verified"` // deprecate
Reviewer string `json:"reviewed_by" meddler:"build_reviewer"`
Reviewed int64 `json:"reviewed_at" meddler:"build_reviewed"`
Procs []*Proc `json:"procs,omitempty" meddler:"-"`
Files []*File `json:"files,omitempty" meddler:"-"`
}
swagger:model build
type CCProject ¶
type CCProject struct {
XMLName xml.Name `xml:"Project"`
Name string `xml:"name,attr"`
Activity string `xml:"activity,attr"`
LastBuildStatus string `xml:"lastBuildStatus,attr"`
LastBuildLabel string `xml:"lastBuildLabel,attr"`
LastBuildTime string `xml:"lastBuildTime,attr"`
WebURL string `xml:"webUrl,attr"`
}
type CCProjects ¶
type Config ¶ added in v0.5.0
type Config struct {
ID int64 `json:"-" meddler:"config_id,pk"`
RepoID int64 `json:"-" meddler:"config_repo_id"`
Data string `json:"data" meddler:"config_data"`
Hash string `json:"hash" meddler:"config_hash"`
}
Config represents a pipeline configuration.
type ConfigStore ¶ added in v0.6.0
type ConfigStore interface {
ConfigLoad(int64) (*Config, error)
ConfigFind(*Repo, string) (*Config, error)
ConfigFindApproved(*Config) (bool, error)
ConfigCreate(*Config) error
}
ConfigStore persists pipeline configuration to storage.
type Environ ¶ added in v0.7.3
type Environ struct {
ID int64 `json:"id" meddler:"env_id,pk"`
Name string `json:"name" meddler:"env_name"`
Value string `json:"value,omitempty" meddler:"env_value"`
}
Environ represents an environment variable. swagger:model environ
type EnvironService ¶ added in v0.7.3
EnvironService defines a service for managing environment variables.
type EnvironStore ¶ added in v0.7.3
EnvironStore persists environment information to storage.
type Event ¶ added in v0.5.0
type Event struct {
Type EventType `json:"type"`
Repo Repo `json:"repo"`
Build Build `json:"build"`
Proc Proc `json:"proc"`
}
Event represents a build event.
type EventType ¶ added in v0.5.0
type EventType string
EventType defines the possible types of build events.
type Feed ¶
type Feed struct {
Owner string `json:"owner" meddler:"repo_owner"`
Name string `json:"name" meddler:"repo_name"`
FullName string `json:"full_name" meddler:"repo_full_name"`
Number int `json:"number,omitempty" meddler:"build_number,zeroisnull"`
Event string `json:"event,omitempty" meddler:"build_event,zeroisnull"`
Status string `json:"status,omitempty" meddler:"build_status,zeroisnull"`
Created int64 `json:"created_at,omitempty" meddler:"build_created,zeroisnull"`
Started int64 `json:"started_at,omitempty" meddler:"build_started,zeroisnull"`
Finished int64 `json:"finished_at,omitempty" meddler:"build_finished,zeroisnull"`
Commit string `json:"commit,omitempty" meddler:"build_commit,zeroisnull"`
Branch string `json:"branch,omitempty" meddler:"build_branch,zeroisnull"`
Ref string `json:"ref,omitempty" meddler:"build_ref,zeroisnull"`
Refspec string `json:"refspec,omitempty" meddler:"build_refspec,zeroisnull"`
Remote string `json:"remote,omitempty" meddler:"build_remote,zeroisnull"`
Title string `json:"title,omitempty" meddler:"build_title,zeroisnull"`
Message string `json:"message,omitempty" meddler:"build_message,zeroisnull"`
Author string `json:"author,omitempty" meddler:"build_author,zeroisnull"`
Avatar string `json:"author_avatar,omitempty" meddler:"build_avatar,zeroisnull"`
Email string `json:"author_email,omitempty" meddler:"build_email,zeroisnull"`
}
Feed represents an item in the user's feed or timeline.
swagger:model feed
type File ¶ added in v0.6.0
type File struct {
ID int64 `json:"id" meddler:"file_id,pk"`
BuildID int64 `json:"-" meddler:"file_build_id"`
ProcID int64 `json:"proc_id" meddler:"file_proc_id"`
PID int `json:"pid" meddler:"file_pid"`
Name string `json:"name" meddler:"file_name"`
Size int `json:"size" meddler:"file_size"`
Mime string `json:"mime" meddler:"file_mime"`
Time int64 `json:"time" meddler:"file_time"`
Passed int `json:"passed" meddler:"file_meta_passed"`
Failed int `json:"failed" meddler:"file_meta_failed"`
Skipped int `json:"skipped" meddler:"file_meta_skipped"`
}
File represents a pipeline artifact.
type FileStore ¶ added in v0.6.0
type FileStore interface {
FileList(*Build) ([]*File, error)
FileFind(*Proc, string) (*File, error)
FileRead(*Proc, string) (io.ReadCloser, error)
FileCreate(*File, io.Reader) error
}
FileStore persists pipeline artifacts to storage.
type Limiter ¶ added in v0.6.0
type Limiter interface {
LimitUser(*User) error
LimitRepo(*User, *Repo) error
LimitRepos(*User, []*Repo) []*Repo
LimitBuild(*User, *Repo, *Build) error
}
Limiter defines an interface for limiting repository creation. This could be used, for example, to limit repository creation to a specific organization or a specific set of users.
type NoLimit ¶ added in v0.6.0
type NoLimit struct{}
NoLimit implements the Limiter interface without enforcing any actual limits. All limiting functions are no-ops.
func (NoLimit) LimitBuild ¶ added in v0.6.0
LimitBuild is a no-op for limiting build creation.
func (NoLimit) LimitRepos ¶ added in v0.8.1
LimitRepos is a no-op for limiting repository listings.
type Perm ¶
type Perm struct {
UserID int64 `json:"-" meddler:"perm_user_id"`
RepoID int64 `json:"-" meddler:"perm_repo_id"`
Repo string `json:"-" meddler:"-"`
Pull bool `json:"pull" meddler:"perm_pull"`
Push bool `json:"push" meddler:"perm_push"`
Admin bool `json:"admin" meddler:"perm_admin"`
Synced int64 `json:"synced" meddler:"perm_synced"`
}
Perm defines a repository permission for an individual user.
type PermStore ¶ added in v0.8.0
type PermStore interface {
PermFind(user *User, repo *Repo) (*Perm, error)
PermUpsert(perm *Perm) error
PermBatch(perms []*Perm) error
PermDelete(perm *Perm) error
PermFlush(user *User, before int64) error
}
PermStore persists repository permissions information to storage.
type Proc ¶ added in v0.6.0
type Proc struct {
ID int64 `json:"id" meddler:"proc_id,pk"`
BuildID int64 `json:"build_id" meddler:"proc_build_id"`
PID int `json:"pid" meddler:"proc_pid"`
PPID int `json:"ppid" meddler:"proc_ppid"`
PGID int `json:"pgid" meddler:"proc_pgid"`
Name string `json:"name" meddler:"proc_name"`
State string `json:"state" meddler:"proc_state"`
Error string `json:"error,omitempty" meddler:"proc_error"`
ExitCode int `json:"exit_code" meddler:"proc_exit_code"`
Started int64 `json:"start_time,omitempty" meddler:"proc_started"`
Stopped int64 `json:"end_time,omitempty" meddler:"proc_stopped"`
Machine string `json:"machine,omitempty" meddler:"proc_machine"`
Platform string `json:"platform,omitempty" meddler:"proc_platform"`
Environ map[string]string `json:"environ,omitempty" meddler:"proc_environ,json"`
Children []*Proc `json:"children,omitempty" meddler:"-"`
}
Proc represents a process in the build pipeline. swagger:model proc
type ProcStore ¶ added in v0.6.0
type ProcStore interface {
ProcLoad(int64) (*Proc, error)
ProcFind(*Build, int) (*Proc, error)
ProcChild(*Build, int, string) (*Proc, error)
ProcList(*Build) ([]*Proc, error)
ProcCreate([]*Proc) error
ProcUpdate(*Proc) error
ProcClear(*Build) error
}
ProcStore persists process information to storage.
type Registry ¶ added in v0.4.2
type Registry struct {
ID int64 `json:"id" meddler:"registry_id,pk"`
RepoID int64 `json:"-" meddler:"registry_repo_id"`
Address string `json:"address" meddler:"registry_addr"`
Username string `json:"username" meddler:"registry_username"`
Password string `json:"password" meddler:"registry_password"`
Email string `json:"email" meddler:"registry_email"`
Token string `json:"token" meddler:"registry_token"`
}
Registry represents a docker registry with credentials. swagger:model registry
type RegistryService ¶ added in v0.6.0
type RegistryService interface {
RegistryFind(*Repo, string) (*Registry, error)
RegistryList(*Repo) ([]*Registry, error)
RegistryCreate(*Repo, *Registry) error
RegistryUpdate(*Repo, *Registry) error
RegistryDelete(*Repo, string) error
}
RegistryService defines a service for managing registries.
type RegistryStore ¶ added in v0.6.0
type RegistryStore interface {
RegistryFind(*Repo, string) (*Registry, error)
RegistryList(*Repo) ([]*Registry, error)
RegistryCreate(*Registry) error
RegistryUpdate(*Registry) error
RegistryDelete(*Registry) error
}
RegistryStore persists registry information to storage.
type Repo ¶
type Repo struct {
ID int64 `json:"id,omitempty" meddler:"repo_id,pk"`
UserID int64 `json:"-" meddler:"repo_user_id"`
Owner string `json:"owner" meddler:"repo_owner"`
Name string `json:"name" meddler:"repo_name"`
FullName string `json:"full_name" meddler:"repo_full_name"`
Avatar string `json:"avatar_url,omitempty" meddler:"repo_avatar"`
Link string `json:"link_url,omitempty" meddler:"repo_link"`
Kind string `json:"scm,omitempty" meddler:"repo_scm"`
Clone string `json:"clone_url,omitempty" meddler:"repo_clone"`
Branch string `json:"default_branch,omitempty" meddler:"repo_branch"`
Timeout int64 `json:"timeout,omitempty" meddler:"repo_timeout"`
Visibility string `json:"visibility" meddler:"repo_visibility"`
IsPrivate bool `json:"private" meddler:"repo_private"`
IsTrusted bool `json:"trusted" meddler:"repo_trusted"`
IsStarred bool `json:"starred,omitempty" meddler:"-"`
IsGated bool `json:"gated" meddler:"repo_gated"`
IsActive bool `json:"active" meddler:"repo_active"`
AllowPull bool `json:"allow_pr" meddler:"repo_allow_pr"`
AllowPush bool `json:"allow_push" meddler:"repo_allow_push"`
AllowDeploy bool `json:"allow_deploys" meddler:"repo_allow_deploys"`
AllowTag bool `json:"allow_tags" meddler:"repo_allow_tags"`
Counter int `json:"last_build" meddler:"repo_counter"`
Config string `json:"config_file" meddler:"repo_config_path"`
Hash string `json:"-" meddler:"repo_hash"`
Perm *Perm `json:"-" meddler:"-"`
}
Repo represents a repository.
swagger:model repo
func (*Repo) ResetVisibility ¶ added in v0.8.0
func (r *Repo) ResetVisibility()
type RepoPatch ¶ added in v0.6.0
type RepoPatch struct {
Config *string `json:"config_file,omitempty"`
IsTrusted *bool `json:"trusted,omitempty"`
IsGated *bool `json:"gated,omitempty"`
Timeout *int64 `json:"timeout,omitempty"`
Visibility *string `json:"visibility,omitempty"`
AllowPull *bool `json:"allow_pr,omitempty"`
AllowPush *bool `json:"allow_push,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
AllowTag *bool `json:"allow_tag,omitempty"`
BuildCounter *int `json:"build_counter,omitempty"`
}
RepoPatch represents a repository patch object.
type ResourceLimit ¶ added in v0.7.3
type ResourceLimit struct {
MemSwapLimit int64
MemLimit int64
ShmSize int64
CPUQuota int64
CPUSet string
}
ResourceLimit is the resource limit to set on pipeline steps
type Secret ¶ added in v0.4.2
type Secret struct {
ID int64 `json:"id" meddler:"secret_id,pk"`
RepoID int64 `json:"-" meddler:"secret_repo_id"`
Name string `json:"name" meddler:"secret_name"`
Value string `json:"value,omitempty" meddler:"secret_value"`
Images []string `json:"image" meddler:"secret_images,json"`
Events []string `json:"event" meddler:"secret_events,json"`
SkipVerify bool `json:"-" meddler:"secret_skip_verify"`
Conceal bool `json:"-" meddler:"secret_conceal"`
}
Secret represents a secret variable, such as a password or token. swagger:model registry
type SecretService ¶ added in v0.6.0
type SecretService interface {
SecretFind(*Repo, string) (*Secret, error)
SecretList(*Repo) ([]*Secret, error)
SecretListBuild(*Repo, *Build) ([]*Secret, error)
SecretCreate(*Repo, *Secret) error
SecretUpdate(*Repo, *Secret) error
SecretDelete(*Repo, string) error
}
SecretService defines a service for managing secrets.
type SecretStore ¶ added in v0.6.0
type SecretStore interface {
SecretFind(*Repo, string) (*Secret, error)
SecretList(*Repo) ([]*Secret, error)
SecretCreate(*Secret) error
SecretUpdate(*Secret) error
SecretDelete(*Secret) error
}
SecretStore persists secret information to storage.
type Sender ¶ added in v0.6.0
type Sender struct {
ID int64 `json:"-" meddler:"sender_id,pk"`
RepoID int64 `json:"-" meddler:"sender_repo_id"`
Login string `json:"login" meddler:"sender_login"`
Allow bool `json:"allow" meddler:"sender_allow"`
Block bool `json:"block" meddler:"sender_block"`
Branch []string `json:"branch" meddler:"-"`
Deploy []string `json:"deploy" meddler:"-"`
Event []string `json:"event" meddler:"-"`
}
type SenderService ¶ added in v0.6.0
type SenderStore ¶ added in v0.6.0
type Settings ¶ added in v0.6.0
type Settings struct {
Open bool // Enables open registration
Secret string // Secret token used to authenticate agents
Admins map[string]bool // Administrative users
Orgs map[string]bool // Organization whitelist
}
Settings defines system configuration parameters.
type Task ¶ added in v0.6.0
type Task struct {
ID string `meddler:"task_id"`
Data []byte `meddler:"task_data"`
Labels map[string]string `meddler:"task_labels,json"`
}
Task defines scheduled pipeline Task.
type TaskStore ¶ added in v0.6.0
type TaskStore interface {
TaskList() ([]*Task, error)
TaskInsert(*Task) error
TaskDelete(string) error
}
TaskStore defines storage for scheduled Tasks.
type Team ¶ added in v0.5.0
type Team struct {
// Login is the username for this team.
Login string `json:"login"`
// the avatar url for this team.
Avatar string `json:"avatar_url"`
}
Team represents a team or organization in the remote version control system.
swagger:model user
type User ¶
type User struct {
// the id for this user.
//
// required: true
ID int64 `json:"id" meddler:"user_id,pk"`
// Login is the username for this user.
//
// required: true
Login string `json:"login" meddler:"user_login"`
// Token is the oauth2 token.
Token string `json:"-" meddler:"user_token"`
// Secret is the oauth2 token secret.
Secret string `json:"-" meddler:"user_secret"`
// Expiry is the token and secret expiration timestamp.
Expiry int64 `json:"-" meddler:"user_expiry"`
// Email is the email address for this user.
//
// required: true
Email string `json:"email" meddler:"user_email"`
// the avatar url for this user.
Avatar string `json:"avatar_url" meddler:"user_avatar"`
// Activate indicates the user is active in the system.
Active bool `json:"active" meddler:"user_active"`
// Synced is the timestamp when the user was synced with the remote system.
Synced int64 `json:"synced" meddler:"user_synced"`
// Admin indicates the user is a system administrator.
//
// NOTE: This is sourced from the DRONE_ADMINS environment variable and is no
// longer persisted in the database.
Admin bool `json:"admin,omitempty" meddler:"-"`
// Hash is a unique token used to sign tokens.
Hash string `json:"-" meddler:"user_hash"`
// DEPRECATED Admin indicates the user is a system administrator.
XAdmin bool `json:"-" meddler:"user_admin"`
}
User represents a registered user.
swagger:model user