Documentation ¶
Index ¶
- Constants
- type Build
- type BuildLog
- type BuildShort
- type BuildStep
- type Pipeline
- type PipelineConfig
- type PipelineConfigStep
- type PipelineInput
- type PipelineShort
- type Project
- type ProjectInput
- type ProjectShort
- type QueueContext
- type QueueElem
- type QueueElemShort
- type Secret
- type SecretInput
- type Variable
- type VariableInput
- type Worker
- func (m *Worker) AfterCreate(tx *gorm.DB) error
- func (m *Worker) AfterDelete(tx *gorm.DB) error
- func (m *Worker) AfterSave(tx *gorm.DB) error
- func (m *Worker) AfterUpdate(tx *gorm.DB) error
- func (m *Worker) BeforeCreate(tx *gorm.DB) error
- func (m *Worker) BeforeDelete(tx *gorm.DB) error
- func (m *Worker) BeforeUpdate(tx *gorm.DB) error
- func (m Worker) PK() (string, error)
- type WorkerInput
- type WorkerShort
Constants ¶
View Source
const ( BuildScheduled = "scheduled" BuildRunning = "running" BuildSuccessful = "successful" BuildFailed = "failed" BuildCanceled = "canceled" )
View Source
const ( WorkerIdle = "idle" WorkerUsed = "used" WorkerUnreachable = "unreachable" )
View Source
const ( WorkerMin = "min" WorkerBalanced = "balance" WorkerMax = "max" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct { Number uint `json:"number" gorm:"primaryKey;uniqueIndex:idx_builds"` PipelineName string `json:"pipeline_name" gorm:"primaryKey;uniqueIndex:idx_builds"` ProjectName string `json:"project_name" gorm:"primaryKey;uniqueIndex:idx_builds"` Status string `json:"status" gorm:"default:scheduled"` Steps []BuildStep `json:"steps,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:BuildNumber,PipelineName,ProjectName"` WorkerName sql.NullString `json:"worker_name"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
func BuildFromID ¶
func (*Build) AppendOutput ¶
type BuildShort ¶
type BuildStep ¶
type BuildStep struct { Name string `json:"name" gorm:"primaryKey;uniqueIndex:idx_build_steps"` BuildNumber uint `json:"-" gorm:"primaryKey;uniqueIndex:idx_build_steps"` PipelineName string `json:"-" gorm:"primaryKey;uniqueIndex:idx_build_steps"` ProjectName string `json:"-" gorm:"primaryKey;uniqueIndex:idx_build_steps"` Start time.Time `json:"start"` Duration string `json:"duration" gorm:"not null"` Logs []BuildLog `json:"logs,omitempty" gorm:"serializer:json"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
func (*BuildStep) AppendOutput ¶
type Pipeline ¶
type Pipeline struct { Name string `json:"name" gorm:"primaryKey;uniqueIndex:idx_pipelines"` ProjectName string `json:"-" gorm:"primaryKey;uniqueIndex:idx_pipelines"` Branch string `json:"branch" gorm:"not null"` Config PipelineConfig `json:"config" gorm:"serializer:json;not null"` Variables []Variable `json:"variables,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:PipelineName,ProjectName"` Secrets []Secret `json:"secrets,omitempty" gorm:"foreignKey:PipelineName,ProjectName"` Builds []Build `json:"builds,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;foreignKey:PipelineName,ProjectName"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
TODO: cascading delete (secrets, issue: https://github.com/go-gorm/gorm/issues/5001)
type PipelineConfig ¶
type PipelineConfigStep ¶
type PipelineInput ¶
type PipelineInput struct { Name string `json:"name"` Branch string `json:"branch"` Config PipelineConfig `json:"config"` }
type PipelineShort ¶
type Project ¶
type Project struct { Name string `json:"name" gorm:"primaryKey"` Repo string `json:"repo" gorm:"not null"` Variables []Variable `json:"variables,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Secrets []Secret `json:"secrets,omitempty"` Pipelines []Pipeline `json:"pipelines,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
TODO: cascading delete (secrets, issue: https://github.com/go-gorm/gorm/issues/5001)
type ProjectInput ¶
type ProjectShort ¶
type QueueContext ¶
type QueueElem ¶
type QueueElem struct { ID string `json:"id" gorm:"primaryKey"` Context QueueContext `json:"context" gorm:"serializer:json;not null"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` }
type QueueElemShort ¶
type Secret ¶
type Secret struct { Key string `json:"key" gorm:"uniqueIndex:idx_secrets"` ProjectName sql.NullString `json:"project_name" gorm:"uniqueIndex:idx_secrets"` PipelineName sql.NullString `json:"pipeline_name" gorm:"uniqueIndex:idx_secrets"` Path string `json:"path,omitempty"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
type SecretInput ¶
type Variable ¶
type Variable struct { Key string `json:"key" gorm:"uniqueIndex:idx_variables"` ProjectName sql.NullString `json:"project_name" gorm:"uniqueIndex:idx_variables"` PipelineName sql.NullString `json:"pipeline_name" gorm:"uniqueIndex:idx_variables"` Value string `json:"value" gorm:"not null"` Path string `json:"path,omitempty"` CreatedAt time.Time `json:"created_at" gorm:"default:now();not null"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now();not null"` }
type VariableInput ¶
type Worker ¶
type Worker struct { Name string `json:"name" gorm:"primaryKey"` Address string `json:"address" gorm:"not null"` System string `json:"system" gorm:"not null"` Username string `json:"username" gorm:"not null"` IsStatic bool `json:"is_static" gorm:"not null"` Status string `json:"status" gorm:"default:idle"` Strategy string `json:"strategy" gorm:"default:balance"` ActiveBuilds int `json:"active_builds" gorm:"default:0"` Capacity int `json:"capacity" gorm:"default:0"` Builds []Build `json:"builds,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` }
type WorkerInput ¶
type WorkerShort ¶
type WorkerShort struct { Name string `json:"name"` Address string `json:"address"` System string `json:"system"` Username string `json:"username"` IsStatic bool `json:"is_static"` Status string `json:"status"` Strategy string `json:"strategy"` ActiveBuilds int `json:"active_builds"` Capacity int `json:"capacity"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.