Documentation
¶
Index ¶
- Variables
- func ConvertFromDroneLine(l *drone.Line) *livelog.Line
- func ConvertFromDroneStage(stage *drone.Stage) *types.Stage
- func ConvertFromDroneStep(step *drone.Step) *types.Step
- func ConvertFromDroneSteps(steps []*drone.Step) []*types.Step
- func ConvertToDroneBuild(execution *types.Execution) *drone.Build
- func ConvertToDroneFile(file *file.File) *client.File
- func ConvertToDroneNetrc(netrc *Netrc) *drone.Netrc
- func ConvertToDroneRepo(repo *types.Repository, repoIsPublic bool) *drone.Repo
- func ConvertToDroneSecret(secret *types.Secret) *drone.Secret
- func ConvertToDroneSecrets(secrets []*types.Secret) []*drone.Secret
- func ConvertToDroneStage(stage *types.Stage) *drone.Stage
- func ConvertToDroneStep(step *types.Step) *drone.Step
- func ConvertToDroneSteps(steps []*types.Step) []*drone.Step
- func NewEmbeddedClient(manager ExecutionManager, urlProvider url.Provider, config *types.Config) client.Client
- func ProvideExecutionClient(manager ExecutionManager, urlProvider url.Provider, config *types.Config) client.Client
- type Config
- type ExecutionContext
- type ExecutionManager
- type Manager
- func (m *Manager) Accept(_ context.Context, id int64, machine string) (*types.Stage, error)
- func (m *Manager) AfterStage(_ context.Context, stage *types.Stage) error
- func (m *Manager) AfterStep(_ context.Context, step *types.Step) error
- func (m *Manager) BeforeStage(_ context.Context, stage *types.Stage) error
- func (m *Manager) BeforeStep(_ context.Context, step *types.Step) error
- func (m *Manager) Details(_ context.Context, stageID int64) (*ExecutionContext, error)
- func (m *Manager) Request(ctx context.Context, args *Request) (*types.Stage, error)
- func (m *Manager) UploadLogs(ctx context.Context, step int64, r io.Reader) error
- func (m *Manager) Watch(ctx context.Context, executionID int64) (bool, error)
- func (m *Manager) Write(ctx context.Context, step int64, line *livelog.Line) error
- type Netrc
- type Request
Constants ¶
This section is empty.
Variables ¶
var WireSet = wire.NewSet( ProvideExecutionManager, ProvideExecutionClient, )
WireSet provides a wire set for this package.
Functions ¶
func ConvertToDroneNetrc ¶
func ConvertToDroneRepo ¶
func ConvertToDroneRepo(repo *types.Repository, repoIsPublic bool) *drone.Repo
func NewEmbeddedClient ¶
func ProvideExecutionClient ¶
func ProvideExecutionClient( manager ExecutionManager, urlProvider url.Provider, config *types.Config, ) client.Client
ProvideExecutionClient provides a client implementation to interact with the execution manager. We use an embedded client here.
Types ¶
type ExecutionContext ¶
type ExecutionContext struct { Repo *types.Repository `json:"repository"` RepoIsPublic bool `json:"repository_is_public,omitempty"` Execution *types.Execution `json:"build"` Stage *types.Stage `json:"stage"` Secrets []*types.Secret `json:"secrets"` Config *file.File `json:"config"` Netrc *Netrc `json:"netrc"` }
ExecutionContext represents the minimum amount of information required by the runner to execute a build.
type ExecutionManager ¶
type ExecutionManager interface { // Request requests the next available build stage for execution. Request(ctx context.Context, args *Request) (*types.Stage, error) // Watch watches for build cancellation requests. Watch(ctx context.Context, executionID int64) (bool, error) // Accept accepts the build stage for execution. Accept(ctx context.Context, stage int64, machine string) (*types.Stage, error) // Write writes a line to the build logs. Write(ctx context.Context, step int64, line *livelog.Line) error // Details returns details about stage. Details(ctx context.Context, stageID int64) (*ExecutionContext, error) // UploadLogs uploads the full logs. UploadLogs(ctx context.Context, step int64, r io.Reader) error // BeforeStep signals the build step is about to start. BeforeStep(ctx context.Context, step *types.Step) error // AfterStep signals the build step is complete. AfterStep(ctx context.Context, step *types.Step) error // BeforeStage signals the build stage is about to start. BeforeStage(ctx context.Context, stage *types.Stage) error // AfterStage signals the build stage is complete. AfterStage(ctx context.Context, stage *types.Stage) error }
ExecutionManager encapsulates complex build operations and provides a simplified interface for build runners.
func ProvideExecutionManager ¶
func ProvideExecutionManager( config *types.Config, executionStore store.ExecutionStore, pipelineStore store.PipelineStore, urlProvider url.Provider, sseStreamer sse.Streamer, fileService file.Service, converterService converter.Service, logStore store.LogStore, logStream livelog.LogStream, checkStore store.CheckStore, repoStore store.RepoStore, scheduler scheduler.Scheduler, secretStore store.SecretStore, stageStore store.StageStore, stepStore store.StepStore, userStore store.PrincipalStore, publicAccess publicaccess.Service, ) ExecutionManager
ProvideExecutionManager provides an execution manager.
type Manager ¶
type Manager struct { Executions store.ExecutionStore Config *types.Config FileService file.Service ConverterService converter.Service Pipelines store.PipelineStore Checks store.CheckStore // Converter store.ConvertService SSEStreamer sse.Streamer // Globals store.GlobalSecretStore Logs store.LogStore Logz livelog.LogStream // Netrcs store.NetrcService Repos store.RepoStore Scheduler scheduler.Scheduler Secrets store.SecretStore // Status store.StatusService Stages store.StageStore Steps store.StepStore // System *store.System Users store.PrincipalStore // contains filtered or unexported fields }
Manager provides a simplified interface to the build runner so that it can more easily interact with the server.
func New ¶
func New( config *types.Config, executionStore store.ExecutionStore, pipelineStore store.PipelineStore, urlProvider urlprovider.Provider, sseStreamer sse.Streamer, fileService file.Service, converterService converter.Service, logStore store.LogStore, logStream livelog.LogStream, checkStore store.CheckStore, repoStore store.RepoStore, scheduler scheduler.Scheduler, secretStore store.SecretStore, stageStore store.StageStore, stepStore store.StepStore, userStore store.PrincipalStore, publicAccess publicaccess.Service, ) *Manager
func (*Manager) Accept ¶
Accept accepts the build stage for execution. It is possible for multiple agents to pull the same stage from the queue.
func (*Manager) AfterStage ¶
AfterAll signals the build stage is complete.
func (*Manager) BeforeStage ¶
BeforeAll signals the build stage is about to start.
func (*Manager) BeforeStep ¶
Before signals the build step is about to start.
func (*Manager) UploadLogs ¶
UploadLogs uploads the full logs.
type Netrc ¶
type Netrc struct { Machine string `json:"machine"` Login string `json:"login"` Password string `json:"password"` }
Netrc contains login and initialization information used by an automated login process.
type Request ¶
type Request struct { Kind string `json:"kind"` Type string `json:"type"` OS string `json:"os"` Arch string `json:"arch"` Variant string `json:"variant"` Kernel string `json:"kernel"` Labels map[string]string `json:"labels,omitempty"` }
Request provides filters when requesting a pending build from the queue. This allows an agent, for example, to request a build that matches its architecture and kernel.