Documentation ¶
Index ¶
- Constants
- Variables
- func HashResourceConfig(checkType string, source atc.Source) string
- func NewNotificationsBus(listener *pq.Listener, conn Conn) *notificationsBus
- func NewPipelineDBFactory(logger lager.Logger, sqldbConnection Conn, bus *notificationsBus, ...) *pipelineDBFactory
- type BasicAuth
- type Build
- type BuildInput
- type BuildOutput
- type BuildPreparation
- type BuildPreparationStatus
- type ConfigDB
- type ConfigVersion
- type Conn
- type Container
- type ContainerIdentifier
- type ContainerMetadata
- type ContainerStage
- type ContainerType
- type DB
- type Dashboard
- type DashboardJob
- type EventSource
- type GitHubAuth
- type GitHubTeam
- type Job
- type JobHistory
- type Lease
- type Lock
- type MetadataField
- type Notifier
- type Page
- type Pagination
- type Pipe
- type Pipeline
- type PipelineDB
- type PipelineDBFactory
- type PipelinePausedState
- type PipelinesDB
- type Resource
- type SQLDB
- func (db *SQLDB) AbortBuild(buildID int) error
- func (db *SQLDB) AbortNotifier(buildID int) (Notifier, error)
- func (db *SQLDB) CreateContainer(container Container, ttl time.Duration) (SavedContainer, error)
- func (db *SQLDB) CreateDefaultTeamIfNotExists() error
- func (db *SQLDB) CreateOneOffBuild() (Build, error)
- func (db *SQLDB) CreatePipe(pipeGUID string, url string) error
- func (db *SQLDB) DeleteContainer(handle string) error
- func (db *SQLDB) DeleteTeamByName(teamName string) error
- func (db *SQLDB) ErrorBuild(buildID int, cause error) error
- func (db *SQLDB) FindContainerByIdentifier(id ContainerIdentifier) (SavedContainer, bool, error)
- func (db *SQLDB) FindContainersByDescriptors(id Container) ([]SavedContainer, error)
- func (db *SQLDB) FinishBuild(buildID int, status Status) error
- func (db *SQLDB) GetAllPipelines() ([]SavedPipeline, error)
- func (db *SQLDB) GetAllStartedBuilds() ([]Build, error)
- func (db *SQLDB) GetBuild(buildID int) (Build, bool, error)
- func (db *SQLDB) GetBuildEvents(buildID int, from uint) (EventSource, error)
- func (db *SQLDB) GetBuildPreparation(passedBuildID int) (BuildPreparation, bool, error)
- func (db *SQLDB) GetBuildResources(buildID int) ([]BuildInput, []BuildOutput, error)
- func (db *SQLDB) GetBuildVersionedResources(buildID int) (SavedVersionedResources, error)
- func (db *SQLDB) GetBuilds(page Page) ([]Build, Pagination, error)
- func (db *SQLDB) GetConfig(teamName, pipelineName string) (atc.Config, ConfigVersion, error)
- func (db *SQLDB) GetConfigByBuildID(buildID int) (atc.Config, ConfigVersion, error)
- func (db *SQLDB) GetContainer(handle string) (SavedContainer, bool, error)
- func (db *SQLDB) GetImageVolumeIdentifiersByBuildID(buildID int) ([]VolumeIdentifier, error)
- func (db *SQLDB) GetPipe(pipeGUID string) (Pipe, error)
- func (db *SQLDB) GetPipelineByTeamNameAndName(teamName string, pipelineName string) (SavedPipeline, error)
- func (db *SQLDB) GetTeamByName(teamName string) (SavedTeam, bool, error)
- func (db *SQLDB) GetVolumeTTL(handle string) (time.Duration, error)
- func (db *SQLDB) GetVolumes() ([]SavedVolume, error)
- func (db *SQLDB) GetVolumesForOneOffBuildImageResources() ([]SavedVolume, error)
- func (db *SQLDB) GetWorker(name string) (SavedWorker, bool, error)
- func (db *SQLDB) InsertVolume(data Volume) error
- func (db *SQLDB) LeaseBuildScheduling(buildID int, interval time.Duration) (Lease, bool, error)
- func (db *SQLDB) LeaseBuildTracking(buildID int, interval time.Duration) (Lease, bool, error)
- func (db *SQLDB) LeaseCacheInvalidation(interval time.Duration) (Lease, bool, error)
- func (db *SQLDB) OrderPipelines(pipelineNames []string) error
- func (db *SQLDB) ReapContainer(handle string) error
- func (db *SQLDB) ReapVolume(handle string) error
- func (db *SQLDB) ResetBuildPreparationsWithPipelinePaused(pipelineID int) error
- func (db *SQLDB) SaveBuildEngineMetadata(buildID int, engineMetadata string) error
- func (db *SQLDB) SaveBuildEvent(buildID int, event atc.Event) error
- func (db *SQLDB) SaveBuildInput(teamName string, buildID int, input BuildInput) (SavedVersionedResource, error)
- func (db *SQLDB) SaveBuildOutput(teamName string, buildID int, vr VersionedResource, explicit bool) (SavedVersionedResource, error)
- func (db *SQLDB) SaveConfig(teamName string, pipelineName string, config atc.Config, from ConfigVersion, ...) (SavedPipeline, bool, error)
- func (db *SQLDB) SaveImageResourceVersion(buildID int, planID atc.PlanID, identifier VolumeIdentifier) error
- func (db *SQLDB) SaveTeam(data Team) (SavedTeam, error)
- func (db *SQLDB) SaveWorker(info WorkerInfo, ttl time.Duration) (SavedWorker, error)
- func (db *SQLDB) SetVolumeTTL(handle string, ttl time.Duration) error
- func (db *SQLDB) StartBuild(buildID int, engine, metadata string) (bool, error)
- func (db *SQLDB) UpdateBuildPreparation(buildPrep BuildPreparation) error
- func (db *SQLDB) UpdateExpiresAtOnContainer(handle string, ttl time.Duration) error
- func (db *SQLDB) UpdateTeamBasicAuth(team Team) (SavedTeam, error)
- func (db *SQLDB) UpdateTeamGitHubAuth(team Team) (SavedTeam, error)
- func (db *SQLDB) Workers() ([]SavedWorker, error)
- type SavedContainer
- type SavedJob
- type SavedPipeline
- type SavedResource
- type SavedTeam
- type SavedVersionedResource
- type SavedVersionedResources
- type SavedVolume
- type SavedWorker
- type Status
- type Team
- type Tx
- type Version
- type VersionHistory
- type VersionedResource
- type VersionedResources
- type Volume
- type VolumeIdentifier
- type WorkerInfo
Constants ¶
View Source
const ( ContainerStageCheck = "check" ContainerStageGet = "get" ContainerStageRun = "run" )
View Source
const BuildPreparationColumns string = "build_id, paused_pipeline, paused_job, max_running_builds, inputs, inputs_satisfied"
Variables ¶
View Source
var ErrBuildEventStreamClosed = errors.New("build event stream closed")
View Source
var ErrConfigComparisonFailed = errors.New("comparison with existing config failed during save")
View Source
var ErrEndOfBuildEventStream = errors.New("end of build event stream")
View Source
var ErrInvalidIdentifier = errors.New("invalid container identifier")
View Source
var ErrLockNotAvailable = errors.New("lock is currently held and cannot be immediately acquired")
View Source
var ErrLockRowNotPresentOrAlreadyDeleted = errors.New("lock could not be acquired because it didn't exist or was already cleaned up")
View Source
var ErrMultipleContainersFound = errors.New("multiple containers found for given identifier")
View Source
var ErrNoBuild = errors.New("no build found")
View Source
var ErrNoContainer = errors.New("no container found")
View Source
var ErrNoVersions = errors.New("no versions found")
View Source
var ErrPipelineNotFound = errors.New("pipeline not found")
Functions ¶
func NewNotificationsBus ¶
func NewPipelineDBFactory ¶
func NewPipelineDBFactory( logger lager.Logger, sqldbConnection Conn, bus *notificationsBus, pipelinesDB PipelinesDB, ) *pipelineDBFactory
Types ¶
type Build ¶
type BuildInput ¶
type BuildInput struct { Name string VersionedResource FirstOccurrence bool }
type BuildOutput ¶
type BuildOutput struct {
VersionedResource
}
type BuildPreparation ¶
type BuildPreparation struct { BuildID int PausedPipeline BuildPreparationStatus PausedJob BuildPreparationStatus MaxRunningBuilds BuildPreparationStatus Inputs map[string]BuildPreparationStatus InputsSatisfied BuildPreparationStatus }
func NewBuildPreparation ¶
func NewBuildPreparation(buildID int) BuildPreparation
type BuildPreparationStatus ¶
type BuildPreparationStatus string
const ( BuildPreparationStatusUnknown BuildPreparationStatus = "unknown" BuildPreparationStatusBlocking BuildPreparationStatus = "blocking" BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking" )
type ConfigDB ¶
type ConfigDB interface { GetConfig(teamName, pipelineName string) (atc.Config, ConfigVersion, error) SaveConfig(string, string, atc.Config, ConfigVersion, PipelinePausedState) (SavedPipeline, bool, error) }
type ConfigVersion ¶
type ConfigVersion int
ConfigVersion is a sequence identifier used for compare-and-swap
type Conn ¶
type Conn interface { Begin() (Tx, error) Close() error Driver() driver.Driver Exec(query string, args ...interface{}) (sql.Result, error) Ping() error Prepare(query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row SetMaxIdleConns(n int) SetMaxOpenConns(n int) }
type Container ¶
type Container struct { ContainerIdentifier ContainerMetadata }
type ContainerIdentifier ¶
type ContainerIdentifier struct { // if it's a resource check container ResourceID int CheckType string CheckSource atc.Source // if it's a step container BuildID int PlanID atc.PlanID // for the check + get stages of a container with a resource backed image ImageResourceType string ImageResourceSource atc.Source Stage ContainerStage }
type ContainerMetadata ¶
type ContainerStage ¶
type ContainerStage string
ContainerStage is used to distinguish between the 3 potential containers in use by a step, as we'll need to run a 'check' and 'get' for the image used by the container, which themselves correspond to containers.
type ContainerType ¶
type ContainerType string
const ( ContainerTypeCheck ContainerType = "check" ContainerTypeGet ContainerType = "get" ContainerTypePut ContainerType = "put" ContainerTypeTask ContainerType = "task" )
func ContainerTypeFromString ¶
func ContainerTypeFromString(containerType string) (ContainerType, error)
func (ContainerType) String ¶
func (containerType ContainerType) String() string
type DB ¶
type DB interface { SaveTeam(team Team) (SavedTeam, error) GetTeamByName(teamName string) (SavedTeam, bool, error) UpdateTeamBasicAuth(team Team) (SavedTeam, error) UpdateTeamGitHubAuth(team Team) (SavedTeam, error) CreateDefaultTeamIfNotExists() error DeleteTeamByName(teamName string) error GetBuild(buildID int) (Build, bool, error) GetBuildVersionedResources(buildID int) (SavedVersionedResources, error) GetBuildResources(buildID int) ([]BuildInput, []BuildOutput, error) GetBuilds(Page) ([]Build, Pagination, error) GetAllStartedBuilds() ([]Build, error) CreatePipe(pipeGUID string, url string) error GetPipe(pipeGUID string) (Pipe, error) CreateOneOffBuild() (Build, error) GetBuildPreparation(buildID int) (BuildPreparation, bool, error) UpdateBuildPreparation(buildPreparation BuildPreparation) error ResetBuildPreparationsWithPipelinePaused(pipelineID int) error LeaseBuildTracking(buildID int, interval time.Duration) (Lease, bool, error) LeaseBuildScheduling(buildID int, interval time.Duration) (Lease, bool, error) LeaseCacheInvalidation(interval time.Duration) (Lease, bool, error) StartBuild(buildID int, engineName, engineMetadata string) (bool, error) FinishBuild(buildID int, status Status) error ErrorBuild(buildID int, cause error) error SaveBuildInput(teamName string, buildID int, input BuildInput) (SavedVersionedResource, error) SaveBuildOutput(teamName string, buildID int, vr VersionedResource, explicit bool) (SavedVersionedResource, error) GetBuildEvents(buildID int, from uint) (EventSource, error) SaveBuildEvent(buildID int, event atc.Event) error SaveBuildEngineMetadata(buildID int, engineMetadata string) error AbortBuild(buildID int) error AbortNotifier(buildID int) (Notifier, error) Workers() ([]SavedWorker, error) // auto-expires workers based on ttl GetWorker(workerName string) (SavedWorker, bool, error) SaveWorker(WorkerInfo, time.Duration) (SavedWorker, error) FindContainersByDescriptors(Container) ([]SavedContainer, error) GetContainer(string) (SavedContainer, bool, error) CreateContainer(Container, time.Duration) (SavedContainer, error) FindContainerByIdentifier(ContainerIdentifier) (SavedContainer, bool, error) UpdateExpiresAtOnContainer(handle string, ttl time.Duration) error ReapContainer(handle string) error DeleteContainer(string) error GetConfigByBuildID(buildID int) (atc.Config, ConfigVersion, error) InsertVolume(data Volume) error GetVolumes() ([]SavedVolume, error) ReapVolume(string) error SetVolumeTTL(string, time.Duration) error GetVolumeTTL(volumeHandle string) (time.Duration, error) GetVolumesForOneOffBuildImageResources() ([]SavedVolume, error) SaveImageResourceVersion(buildID int, planID atc.PlanID, identifier VolumeIdentifier) error GetImageVolumeIdentifiersByBuildID(buildID int) ([]VolumeIdentifier, error) }
type Dashboard ¶
type Dashboard []DashboardJob
type DashboardJob ¶
type GitHubAuth ¶
type GitHubAuth struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` Organizations []string `json:"organizations"` Teams []GitHubTeam `json:"teams"` Users []string `json:"users"` }
type GitHubTeam ¶
type JobHistory ¶
type MetadataField ¶
type Pagination ¶
type PipelineDB ¶
type PipelineDB interface { GetPipelineName() string ScopedName(string) string Pause() error Unpause() error IsPaused() (bool, error) Destroy() error GetConfig() (atc.Config, ConfigVersion, bool, error) LeaseScheduling(time.Duration) (Lease, bool, error) GetResource(resourceName string) (SavedResource, error) GetResourceVersions(resourceName string, page Page) ([]SavedVersionedResource, Pagination, bool, error) PauseResource(resourceName string) error UnpauseResource(resourceName string) error SaveResourceVersions(atc.ResourceConfig, []atc.Version) error GetLatestVersionedResource(resource SavedResource) (SavedVersionedResource, bool, error) GetLatestEnabledVersionedResource(resourceName string) (SavedVersionedResource, bool, error) EnableVersionedResource(versionedResourceID int) error DisableVersionedResource(versionedResourceID int) error SetResourceCheckError(resource SavedResource, err error) error LeaseResourceChecking(resource string, length time.Duration, immediate bool) (Lease, bool, error) GetJob(job string) (SavedJob, error) PauseJob(job string) error UnpauseJob(job string) error GetJobFinishedAndNextBuild(job string) (*Build, *Build, error) GetJobBuilds(job string, page Page) ([]Build, Pagination, error) GetAllJobBuilds(job string) ([]Build, error) GetJobBuild(job string, build string) (Build, bool, error) CreateJobBuild(job string) (Build, error) CreateJobBuildForCandidateInputs(job string) (Build, bool, error) UseInputsForBuild(buildID int, inputs []BuildInput) error LoadVersionsDB() (*algorithm.VersionsDB, error) GetLatestInputVersions(versions *algorithm.VersionsDB, job string, inputs []config.JobInput) ([]BuildInput, bool, error) GetJobBuildForInputs(job string, inputs []BuildInput) (Build, bool, error) GetNextPendingBuild(job string) (Build, bool, error) GetBuild(buildID int) (Build, bool, error) GetCurrentBuild(job string) (Build, bool, error) GetRunningBuildsBySerialGroup(jobName string, serialGroups []string) ([]Build, error) GetNextPendingBuildBySerialGroup(jobName string, serialGroups []string) (Build, bool, error) UpdateBuildToScheduled(buildID int) (bool, error) SaveBuildInput(buildID int, input BuildInput) (SavedVersionedResource, error) SaveBuildOutput(buildID int, vr VersionedResource, explicit bool) (SavedVersionedResource, error) GetBuildsWithVersionAsInput(versionedResourceID int) ([]Build, error) GetBuildsWithVersionAsOutput(versionedResourceID int) ([]Build, error) UpdateBuildPreparation(prep BuildPreparation) error GetDashboard() (Dashboard, atc.GroupConfigs, error) }
type PipelineDBFactory ¶
type PipelineDBFactory interface { Build(pipeline SavedPipeline) PipelineDB BuildWithTeamNameAndName(teamName, pipelineName string) (PipelineDB, error) BuildDefault() (PipelineDB, bool, error) }
type PipelinePausedState ¶
type PipelinePausedState string
const ( PipelinePaused PipelinePausedState = "paused" PipelineUnpaused PipelinePausedState = "unpaused" PipelineNoChange PipelinePausedState = "nochange" )
func (PipelinePausedState) Bool ¶
func (state PipelinePausedState) Bool() *bool
type PipelinesDB ¶
type PipelinesDB interface { GetAllPipelines() ([]SavedPipeline, error) GetPipelineByTeamNameAndName(teamName string, pipelineName string) (SavedPipeline, error) OrderPipelines([]string) error }
type SQLDB ¶
type SQLDB struct {
// contains filtered or unexported fields
}
func (*SQLDB) AbortBuild ¶
func (*SQLDB) CreateContainer ¶
func (*SQLDB) CreateDefaultTeamIfNotExists ¶
func (*SQLDB) CreateOneOffBuild ¶
func (*SQLDB) DeleteContainer ¶
func (*SQLDB) DeleteTeamByName ¶
func (*SQLDB) FindContainerByIdentifier ¶
func (db *SQLDB) FindContainerByIdentifier(id ContainerIdentifier) (SavedContainer, bool, error)
func (*SQLDB) FindContainersByDescriptors ¶
func (db *SQLDB) FindContainersByDescriptors(id Container) ([]SavedContainer, error)
func (*SQLDB) GetAllPipelines ¶
func (db *SQLDB) GetAllPipelines() ([]SavedPipeline, error)
func (*SQLDB) GetAllStartedBuilds ¶
func (*SQLDB) GetBuildEvents ¶
func (db *SQLDB) GetBuildEvents(buildID int, from uint) (EventSource, error)
func (*SQLDB) GetBuildPreparation ¶
func (db *SQLDB) GetBuildPreparation(passedBuildID int) (BuildPreparation, bool, error)
func (*SQLDB) GetBuildResources ¶
func (db *SQLDB) GetBuildResources(buildID int) ([]BuildInput, []BuildOutput, error)
func (*SQLDB) GetBuildVersionedResources ¶
func (db *SQLDB) GetBuildVersionedResources(buildID int) (SavedVersionedResources, error)
func (*SQLDB) GetConfigByBuildID ¶
func (*SQLDB) GetContainer ¶
func (db *SQLDB) GetContainer(handle string) (SavedContainer, bool, error)
func (*SQLDB) GetImageVolumeIdentifiersByBuildID ¶
func (db *SQLDB) GetImageVolumeIdentifiersByBuildID(buildID int) ([]VolumeIdentifier, error)
func (*SQLDB) GetPipelineByTeamNameAndName ¶
func (db *SQLDB) GetPipelineByTeamNameAndName(teamName string, pipelineName string) (SavedPipeline, error)
func (*SQLDB) GetTeamByName ¶
func (*SQLDB) GetVolumes ¶
func (db *SQLDB) GetVolumes() ([]SavedVolume, error)
func (*SQLDB) GetVolumesForOneOffBuildImageResources ¶
func (db *SQLDB) GetVolumesForOneOffBuildImageResources() ([]SavedVolume, error)
func (*SQLDB) InsertVolume ¶
func (*SQLDB) LeaseBuildScheduling ¶
func (*SQLDB) LeaseBuildTracking ¶
func (*SQLDB) LeaseCacheInvalidation ¶
func (*SQLDB) OrderPipelines ¶
func (*SQLDB) ReapContainer ¶
func (*SQLDB) ReapVolume ¶
func (*SQLDB) ResetBuildPreparationsWithPipelinePaused ¶
func (*SQLDB) SaveBuildEngineMetadata ¶
func (*SQLDB) SaveBuildInput ¶
func (db *SQLDB) SaveBuildInput(teamName string, buildID int, input BuildInput) (SavedVersionedResource, error)
func (*SQLDB) SaveBuildOutput ¶
func (db *SQLDB) SaveBuildOutput(teamName string, buildID int, vr VersionedResource, explicit bool) (SavedVersionedResource, error)
func (*SQLDB) SaveConfig ¶
func (db *SQLDB) SaveConfig( teamName string, pipelineName string, config atc.Config, from ConfigVersion, pausedState PipelinePausedState, ) (SavedPipeline, bool, error)
func (*SQLDB) SaveImageResourceVersion ¶
func (*SQLDB) SaveWorker ¶
func (db *SQLDB) SaveWorker(info WorkerInfo, ttl time.Duration) (SavedWorker, error)
func (*SQLDB) StartBuild ¶
func (*SQLDB) UpdateBuildPreparation ¶
func (db *SQLDB) UpdateBuildPreparation(buildPrep BuildPreparation) error
func (*SQLDB) UpdateExpiresAtOnContainer ¶
func (*SQLDB) UpdateTeamBasicAuth ¶
func (*SQLDB) UpdateTeamGitHubAuth ¶
func (*SQLDB) Workers ¶
func (db *SQLDB) Workers() ([]SavedWorker, error)
type SavedContainer ¶
type SavedResource ¶
func (SavedResource) FailingToCheck ¶
func (r SavedResource) FailingToCheck() bool
type SavedVersionedResource ¶
type SavedVersionedResources ¶
type SavedVersionedResources []SavedVersionedResource
func (SavedVersionedResources) Lookup ¶
func (vrs SavedVersionedResources) Lookup(name string) (SavedVersionedResource, bool)
type SavedWorker ¶
type SavedWorker struct { WorkerInfo ExpiresIn time.Duration }
type VersionHistory ¶
type VersionHistory struct { VersionedResource SavedVersionedResource InputsTo []*JobHistory OutputsOf []*JobHistory }
type VersionedResource ¶
type VersionedResource struct { Resource string Type string Version Version Metadata []MetadataField PipelineName string }
type VersionedResources ¶
type VersionedResources []VersionedResource
func (VersionedResources) Lookup ¶
func (vrs VersionedResources) Lookup(name string) (VersionedResource, bool)
type Volume ¶
type Volume struct { WorkerName string TTL time.Duration Handle string VolumeIdentifier }
type VolumeIdentifier ¶
type WorkerInfo ¶
Source Files ¶
- build.go
- build_preparation.go
- container.go
- db.go
- errors.go
- explain_db.go
- job.go
- lease.go
- pagination.go
- pipe.go
- pipeline.go
- pipeline_db.go
- pipeline_db_factory.go
- pipeline_db_jobs.go
- sqldb.go
- sqldb_builds.go
- sqldb_bus.go
- sqldb_containers.go
- sqldb_eventsource.go
- sqldb_image_versions.go
- sqldb_leases.go
- sqldb_pipelines.go
- sqldb_pipes.go
- sqldb_teams.go
- sqldb_volumes.go
- sqldb_workers.go
- team.go
Directories ¶
Path | Synopsis |
---|---|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter |
fakes
This file was generated by counterfeiter
|
This file was generated by counterfeiter |
Click to show internal directories.
Click to hide internal directories.