jobs

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncProjectCommandOutputHandler

type AsyncProjectCommandOutputHandler struct {
	// contains filtered or unexported fields
}

AsyncProjectCommandOutputHandler is a handler to transport terraform client outputs to the front end.

func (*AsyncProjectCommandOutputHandler) CleanUp

func (p *AsyncProjectCommandOutputHandler) CleanUp(pullInfo PullInfo)

func (*AsyncProjectCommandOutputHandler) Deregister

func (p *AsyncProjectCommandOutputHandler) Deregister(jobID string, ch chan string)

Remove channel, so client no longer receives Terraform output

func (*AsyncProjectCommandOutputHandler) GetJobIDMapForPull

func (p *AsyncProjectCommandOutputHandler) GetJobIDMapForPull(pullInfo PullInfo) map[string]time.Time

func (*AsyncProjectCommandOutputHandler) GetProjectOutputBuffer

func (p *AsyncProjectCommandOutputHandler) GetProjectOutputBuffer(jobID string) OutputBuffer

func (*AsyncProjectCommandOutputHandler) GetPullToJobMapping added in v0.27.0

func (p *AsyncProjectCommandOutputHandler) GetPullToJobMapping() []PullInfoWithJobIDs

func (*AsyncProjectCommandOutputHandler) GetReceiverBufferForPull

func (p *AsyncProjectCommandOutputHandler) GetReceiverBufferForPull(jobID string) map[chan string]bool

func (*AsyncProjectCommandOutputHandler) Handle

func (*AsyncProjectCommandOutputHandler) IsKeyExists

func (p *AsyncProjectCommandOutputHandler) IsKeyExists(key string) bool

func (*AsyncProjectCommandOutputHandler) Register

func (p *AsyncProjectCommandOutputHandler) Register(jobID string, receiver chan string)

func (*AsyncProjectCommandOutputHandler) Send

func (p *AsyncProjectCommandOutputHandler) Send(ctx command.ProjectContext, msg string, operationComplete bool)

func (*AsyncProjectCommandOutputHandler) SendWorkflowHook added in v0.22.0

func (p *AsyncProjectCommandOutputHandler) SendWorkflowHook(ctx models.WorkflowHookCommandContext, msg string, operationComplete bool)

type JobIDInfo added in v0.27.0

type JobIDInfo struct {
	JobID         string
	JobIDUrl      string
	Time          time.Time
	TimeFormatted string
}

type JobInfo

type JobInfo struct {
	PullInfo
	HeadCommit string
}

type JobURLSetter

type JobURLSetter struct {
	// contains filtered or unexported fields
}

func NewJobURLSetter

func NewJobURLSetter(projectJobURLGenerator ProjectJobURLGenerator, projectStatusUpdater ProjectStatusUpdater) *JobURLSetter

func (*JobURLSetter) SetJobURLWithStatus

func (j *JobURLSetter) SetJobURLWithStatus(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, result *command.ProjectResult) error

type NoopProjectOutputHandler

type NoopProjectOutputHandler struct{}

NoopProjectOutputHandler is a mock that doesn't do anything

func (*NoopProjectOutputHandler) CleanUp

func (p *NoopProjectOutputHandler) CleanUp(_ PullInfo)

func (*NoopProjectOutputHandler) Deregister

func (p *NoopProjectOutputHandler) Deregister(_ string, _ chan string)

func (*NoopProjectOutputHandler) GetPullToJobMapping added in v0.27.0

func (p *NoopProjectOutputHandler) GetPullToJobMapping() []PullInfoWithJobIDs

func (*NoopProjectOutputHandler) Handle

func (p *NoopProjectOutputHandler) Handle()

func (*NoopProjectOutputHandler) IsKeyExists

func (p *NoopProjectOutputHandler) IsKeyExists(_ string) bool

func (*NoopProjectOutputHandler) Register

func (p *NoopProjectOutputHandler) Register(_ string, _ chan string)

func (*NoopProjectOutputHandler) Send

func (*NoopProjectOutputHandler) SendWorkflowHook added in v0.22.0

type OutputBuffer

type OutputBuffer struct {
	OperationComplete bool
	Buffer            []string
}

type ProjectCmdOutputLine

type ProjectCmdOutputLine struct {
	JobID             string
	JobInfo           JobInfo
	Line              string
	OperationComplete bool
}

type ProjectCommandOutputHandler

type ProjectCommandOutputHandler interface {
	// Send will enqueue the msg and wait for Handle() to receive the message.
	Send(ctx command.ProjectContext, msg string, operationComplete bool)

	SendWorkflowHook(ctx models.WorkflowHookCommandContext, msg string, operationComplete bool)

	// Register registers a channel and blocks until it is caught up. Callers should call this asynchronously when attempting
	// to read the channel in the same goroutine
	Register(jobID string, receiver chan string)

	// Deregister removes a channel from successive updates and closes it.
	Deregister(jobID string, receiver chan string)

	IsKeyExists(key string) bool

	// Listens for msg from channel
	Handle()

	// Cleans up resources for a pull
	CleanUp(pullInfo PullInfo)

	// Returns a map from Pull Requests to Jobs
	GetPullToJobMapping() []PullInfoWithJobIDs
}

func NewAsyncProjectCommandOutputHandler

func NewAsyncProjectCommandOutputHandler(
	projectCmdOutput chan *ProjectCmdOutputLine,
	logger logging.SimpleLogging,
) ProjectCommandOutputHandler

type ProjectJobURLGenerator

type ProjectJobURLGenerator interface {
	GenerateProjectJobURL(p command.ProjectContext) (string, error)
}

ProjectJobURLGenerator generates urls to view project's progress.

type ProjectStatusUpdater

type ProjectStatusUpdater interface {
	// UpdateProject sets the commit status for the project represented by
	// ctx.
	UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, res *command.ProjectResult) error
}

type PullInfo

type PullInfo struct {
	PullNum      int
	Repo         string
	RepoFullName string
	ProjectName  string
	Path         string
	Workspace    string
}

type PullInfoWithJobIDs added in v0.27.0

type PullInfoWithJobIDs struct {
	Pull       PullInfo
	JobIDInfos []JobIDInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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