model

package
v0.0.0-...-ddc8f8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventPush   = "push"
	EventPull   = "pull_request"
	EventTag    = "tag"
	EventManual = "manual"
)
View Source
const (
	BuildManual = "manual"
	BuildFork   = "fork"
	BuildRerun  = "rerun"
)
View Source
const (
	StatusSkipped  = "skipped"
	StatusPending  = "pending"
	StatusRunning  = "running"
	StatusSuccess  = "success"
	StatusFailure  = "failure"
	StatusKilled   = "killed"
	StatusError    = "error"
	StatusBlocked  = "blocked"
	StatusDeclined = "declined"
)
View Source
const (
	VisibilityPublic   = "public"
	VisibilityPrivate  = "private"
	VisibilityInternal = "internal"
)

example: gitlab project have these three project type.

View Source
const (
	RepoGit = "git"
)

Variables

This section is empty.

Functions

func WithTaskStore

func WithTaskStore(q queue.Queue, s TaskStore) queue.Queue

WithTaskStore returns a queue that is backed by the TaskStore. This ensures the task Queue can be restored when the system starts.

func WithTaskStoreRedis

func WithTaskStoreRedis(q queue.Queue, s TaskStore) queue.Queue

WithTaskStore returns a queue that is backed by the TaskStore. This ensures the task Queue can be restored when the system starts.

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"`
	Event    string  `json:"event"         meddler:"build_event"`
	Status   string  `json:"status"        meddler:"build_status"`
	Error    string  `json:"error"         meddler:"build_error"`
	Created  int64   `json:"created_at"    meddler:"build_created"`
	Started  int64   `json:"started_at"    meddler:"build_started"`
	Enqueued int64   `json:"enqueued_at"   meddler:"build_enqueued"`
	Finished int64   `json:"finished_at"   meddler:"build_finished"`
	Link     string  `json:"link_url"      meddler:"build_link"`
	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"`
	Procs    []*Proc `json:"procs,omitempty" meddler:"-"`
}

swagger:model build

type Config

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

type ConfigStore interface {
	ConfigCreate(*Config) error
	ConfigLoad(int64) (*Config, error)
}

ConfigStore persists pipeline configuration to storage. Often access by handler.Config.Storage.Config

type File

type File struct {
	ID      int64  `json:"id"       meddler:"file_id,pk"`
	BuildID int64  `json:"build_id" meddler:"file_build_id"`
	ProcID  int64  `json:"proc_id"  meddler:"file_proc_id"`
	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"`
}

File represents a pipeline artifact.

type FileStore

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 LogData

type LogData struct {
	ID     int64  `meddler:"log_id,pk"`
	ProcID int64  `meddler:"log_job_id"`
	Data   []byte `meddler:"log_data"`
}

type Netrc

type Netrc struct {
	Machine  string `json:"machine"`
	Login    string `json:"login"`
	Password string `json:"password"`
}

type Proc

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

func Tree

func Tree(procs []*Proc) []*Proc

Tree creates a process tree from a flat process list.

func (*Proc) Failing

func (p *Proc) Failing() bool

Failing returns true if the process state is failed, killed or error.

func (*Proc) Running

func (p *Proc) Running() bool

Running returns true if the process state is pending or running.

type ProcStore

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

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 Repo

type Repo struct {
	ID          int64  `json:"id,omitempty"               meddler:"repo_id,pk"`
	ScmId       int64  `json:"-"                          meddler:"repo_scm_id"`
	Owner       string `json:"owner,omitempty"            meddler:"repo_owner"`
	FullName    string `json:"full_name"                  meddler:"repo_full_name"`
	Link        string `json:"link_url,omitempty"         meddler:"repo_link"`
	Name        string `json:"name,omitempty"             meddler:"repo_name"`
	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"`
	IsPrivate   bool   `json:"private,omitempty"          meddler:"repo_private"`
	AllowPull   bool   `json:"allow_pr"                   meddler:"repo_allow_pr"`
	AllowPush   bool   `json:"allow_push"                 meddler:"repo_allow_push"`
	AllowTag    bool   `json:"allow_tags"                 meddler:"repo_allow_tags"`
	AllowManual bool   `json:"allow_manual"               meddler:"repo_allow_manual"`
	Counter     int    `json:"last_build"                 meddler:"repo_counter"`
	Hash        string `json:"-"                          meddler:"repo_hash"`
}

swagger:model build

type RepoLite

type RepoLite struct {
	ID       int    `json:"remote_id"`
	Owner    string `json:"owner"`
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	Clone    string `json:"clone_url"`
	Branch   string `json:"default_branch"`
}

type ResourceLimit

type ResourceLimit struct {
	MemSwapLimit int64
	MemLimit     int64
	ShmSize      int64
	CPUQuota     int64
	CPUShares    int64
	CPUSet       string
}

ResourceLimit is the resource limit to set on pipeline steps

type ScmAccount

type ScmAccount struct {
	ID           int64  `json:"id,omitempty"            meddler:"scm_id,pk"`
	Host         string `json:"host,omitempty"          meddler:"scm_host"`
	Login        string `json:"login,omitempty"         meddler:"scm_login"`
	Password     string `json:"password,omitempty"      meddler:"scm_password"`
	PrivateToken string `json:"private_token,omitempty" meddler:"scm_private_token"`
	Type         string `json:"scm_type,omitempty"      meddler:"scm_type"`
}

swagger:model build

type Secret

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"`
}

Secret represents a secret variable, such as a password or token. swagger:model registry

type Task

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

type TaskStore interface {
	TaskList() ([]*Task, error)
	TaskInsert(*Task) error
	TaskDelete(string) error
}

TaskStore defines storage for scheduled Tasks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL