event

package
v0.6.0-beta.202406200942 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandPipelineCancel      = "command.pipeline_cancel"
	HandlerPipelineCancelled   = "handler.pipeline_canceled"
	CommandPipelineFail        = "command.pipeline_fail"
	HandlerPipelineFailed      = "handler.pipeline_failed"
	CommandPipelineFinish      = "command.pipeline_finish"
	HandlerPipelineFinished    = "handler.pipeline_finished"
	CommandPipelineLoad        = "command.pipeline_load"
	HandlerPipelineLoaded      = "handler.pipeline_loaded"
	CommandPipelinePause       = "command.pipeline_pause"
	HandlerPipelinePaused      = "handler.pipeline_paused"
	CommandPipelinePlan        = "command.pipeline_plan"
	HandlerPipelinePlanned     = "handler.pipeline_planned"
	CommandPipelineQueue       = "command.pipeline_queue"
	HandlerPipelineQueued      = "handler.pipeline_queued"
	CommandPipelineResume      = "command.pipeline_resume"
	HandlerPipelineResumed     = "handler.pipeline_resumed"
	CommandPipelineStart       = "command.pipeline_start"
	HandlerPipelineStarted     = "handler.pipeline_started"
	HandlerStepFinished        = "handler.step_finished"
	CommandStepForEachPlan     = "command.step_for_each_plan"
	HandlerStepForEachPlanned  = "handler.step_for_each_planned"
	CommandStepPipelineFinish  = "command.step_pipeline_finish"
	HandlerStepPipelineStarted = "handler.step_pipeline_started"
	CommandStepQueue           = "command.step_queue"
	HandlerStepQueued          = "handler.step_queued"
	CommandStepStart           = "command.step_start"
)

Variables

This section is empty.

Functions

func GetEventStoreMutex

func GetEventStoreMutex(executionId string) *sync.Mutex

func ReleaseEventLogMutex

func ReleaseEventLogMutex(executionId string)

Types

type CommandEvent

type CommandEvent interface {
	GetEvent() *Event
	HandlerName() string
}

type Event

type Event struct {
	// Every execution has a unique ID. This is used right through from initial
	// triggering down through all pipelines, steps and nested pipelines.
	ExecutionID string `json:"execution_id"`
	// Time when the command was created.
	CreatedAt time.Time `json:"created_at"`
}

All events have a shared structure to track execution context.

func NewChildEvent

func NewChildEvent(parent *Event) *Event

func NewEventForExecutionID

func NewEventForExecutionID(executionID string) *Event

func NewExecutionEvent

func NewExecutionEvent() *Event

func NewFlowEvent

func NewFlowEvent(before *Event) *Event

func NewParentEvent

func NewParentEvent(child *Event) *Event

type EventLogEntry

type EventLogEntry struct {
	Level     string      `json:"level"`
	Timestamp string      `json:"ts"`
	Caller    string      `json:"caller"`
	Message   string      `json:"msg"`
	EventType string      `json:"event_type"`
	Payload   interface{} `json:"payload"`
}

Define a struct that represents your JSON structure

type PayloadWithEvent

type PayloadWithEvent struct {
	Event *Event `json:"event"`
}

type PipelineCancel

type PipelineCancel struct {
	// Event metadata
	Event *Event `json:"event"`

	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	ExecutionID         string `json:"execution_id,omitempty"`

	// Reason for the cancellation
	Reason string `json:"reason,omitempty"`
}

func NewPipelineCancel

func NewPipelineCancel(pipelineExecutionID string, opts ...PipelineCancelOption) (*PipelineCancel, error)

NewPipelineCancel creates a new PipelineCancel event.

func (*PipelineCancel) GetEvent

func (e *PipelineCancel) GetEvent() *Event

func (*PipelineCancel) HandlerName

func (e *PipelineCancel) HandlerName() string

type PipelineCancelOption

type PipelineCancelOption func(*PipelineCancel) error

ExecutionOption is a function that modifies an Execution instance.

type PipelineCanceled

type PipelineCanceled struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// Reason for the cancellation
	Reason string `json:"reason,omitempty"`
}

func NewPipelineCanceledFromPipelineCancel

func NewPipelineCanceledFromPipelineCancel(cmd *PipelineCancel) *PipelineCanceled

func (*PipelineCanceled) GetEvent

func (e *PipelineCanceled) GetEvent() *Event

func (*PipelineCanceled) HandlerName

func (e *PipelineCanceled) HandlerName() string

type PipelineFail

type PipelineFail struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// Error details
	Error *modconfig.StepError `json:"error,omitempty"`
}

func NewPipelineFail

func NewPipelineFail(opts ...PipelineFailOption) *PipelineFail

NewPipelineFail creates a new PipelineFail event. Unlike other events, creating a pipeline fail event cannot have an error as an option (because we're already handling errors).

func NewPipelineFailFromPipelinePlanned

func NewPipelineFailFromPipelinePlanned(e *PipelinePlanned, err error) *PipelineFail

func NewPipelineFailFromStepForEachPlanned

func NewPipelineFailFromStepForEachPlanned(e *StepForEachPlanned, err error) *PipelineFail

func (*PipelineFail) GetEvent

func (e *PipelineFail) GetEvent() *Event

func (*PipelineFail) HandlerName

func (e *PipelineFail) HandlerName() string

type PipelineFailOption

type PipelineFailOption func(*PipelineFail)

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineFinishedToPipelineFail

func ForPipelineFinishedToPipelineFail(e *PipelineFinished, err error) PipelineFailOption

func ForPipelineLoadedToPipelineFail

func ForPipelineLoadedToPipelineFail(e *PipelineLoaded, err error) PipelineFailOption

func ForPipelineQueuedToPipelineFail

func ForPipelineQueuedToPipelineFail(e *PipelineQueued, err error) PipelineFailOption

func ForPipelineResumedToPipelineFail

func ForPipelineResumedToPipelineFail(e *PipelineResumed, err error) PipelineFailOption

func ForPipelineStartedToPipelineFail

func ForPipelineStartedToPipelineFail(e *PipelineStarted, err error) PipelineFailOption

func ForPipelineStepFinishedToPipelineFail

func ForPipelineStepFinishedToPipelineFail(e *StepFinished, err error) PipelineFailOption

func ForStepPipelineStartedToPipelineFail

func ForStepPipelineStartedToPipelineFail(e *StepPipelineStarted, err error) PipelineFailOption

func ForStepQueuedToPipelineFail

func ForStepQueuedToPipelineFail(e *StepQueued, err error) PipelineFailOption

type PipelineFailed

type PipelineFailed struct {
	// Event metadata
	Event *Event `json:"event"`

	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`

	Errors []modconfig.StepError `json:"error,omitempty"`

	PipelineOutput map[string]interface{} `json:"pipeline_output"`
}

func NewPipelineFailed

func NewPipelineFailed(ctx context.Context, opts ...PipelineFailedOption) *PipelineFailed

NewPipelineFailed creates a new PipelineFailed event. Unlike other events, creating a pipeline failed event cannot have an error as an option (because we're already handling errors).

func NewPipelineFailedFromPipelineFail

func NewPipelineFailedFromPipelineFail(cmd *PipelineFail, pipelineOutput map[string]interface{}, pipelineErrors []modconfig.StepError) *PipelineFailed

func NewPipelineFailedFromPipelineLoad

func NewPipelineFailedFromPipelineLoad(cmd *PipelineLoad, err error) *PipelineFailed

func NewPipelineFailedFromStepForEachPlan

func NewPipelineFailedFromStepForEachPlan(cmd *StepForEachPlan, err error) *PipelineFailed

func NewPipelineFailedFromStepPipelineFinish

func NewPipelineFailedFromStepPipelineFinish(cmd *StepPipelineFinish, err error) *PipelineFailed

func (*PipelineFailed) GetEvent

func (e *PipelineFailed) GetEvent() *Event

func (*PipelineFailed) HandlerName

func (e *PipelineFailed) HandlerName() string

func (*PipelineFailed) UnmarshalJSON

func (p *PipelineFailed) UnmarshalJSON(data []byte) error

type PipelineFailedOption

type PipelineFailedOption func(*PipelineFailed) error

PipelineFailedOption is a function that modifies an Execution instance.

func ForPipelineCancelToPipelineFailed

func ForPipelineCancelToPipelineFailed(cmd *PipelineCancel, err error) PipelineFailedOption

ForPipelineCancelToPipelineFailed returns a PipelineFailedOption that sets the fields of the PipelineFailed event from a PipelineCancel command.

func ForPipelineFinishToPipelineFailed

func ForPipelineFinishToPipelineFailed(cmd *PipelineFinish, err error) PipelineFailedOption

func ForPipelinePauseToPipelineFailed

func ForPipelinePauseToPipelineFailed(cmd *PipelinePause, err error) PipelineFailedOption

func ForPipelinePlanToPipelineFailed

func ForPipelinePlanToPipelineFailed(cmd *PipelinePlan, err error, pipelineName string, stepName string) PipelineFailedOption

ForPipelinePlanToPipelineFailed returns a PipelineFailedOption that sets the fields of the PipelineFailed event from a PipelinePlan command.

func ForPipelineQueueToPipelineFailed

func ForPipelineQueueToPipelineFailed(cmd *PipelineQueue, err error) PipelineFailedOption

ForPipelineQueueToPipelineFailed returns a PipelineFailedOption that sets the fields of the PipelineFailed event from a PipelineQueue command.

func ForPipelineResumeToPipelineFailed

func ForPipelineResumeToPipelineFailed(cmd *PipelineResume, err error) PipelineFailedOption

func ForPipelineStartToPipelineFailed

func ForPipelineStartToPipelineFailed(cmd *PipelineStart, err error) PipelineFailedOption

ForPipelineStartToPipelineFailed returns a PipelineFailedOption that sets the fields of the PipelineFailed event from a PipelineStart command.

func ForStepQueueToPipelineFailed

func ForStepQueueToPipelineFailed(cmd *StepQueue, err error) PipelineFailedOption

func ForStepStartToPipelineFailed

func ForStepStartToPipelineFailed(cmd *StepStart, err error) PipelineFailedOption

func PipelineFailedWithEvent

func PipelineFailedWithEvent(event *Event) PipelineFailedOption

func PipelineFailedWithMultipleErrors

func PipelineFailedWithMultipleErrors(pipelineExecutionID string, pipelineName string, errs []perr.ErrorModel) PipelineFailedOption

func PipelineFailedWithOutput

func PipelineFailedWithOutput(output map[string]any) PipelineFailedOption

type PipelineFinish

type PipelineFinish struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string            `json:"pipeline_execution_id"`
	Output              *modconfig.Output `json:"output,omitempty"`
}

func NewPipelineFinish

func NewPipelineFinish(opts ...PipelineFinishOption) (*PipelineFinish, error)

NewPipelineFinish creates a new PipelineFinish event.

func (*PipelineFinish) GetEvent

func (e *PipelineFinish) GetEvent() *Event

func (*PipelineFinish) HandlerName

func (e *PipelineFinish) HandlerName() string

type PipelineFinishOption

type PipelineFinishOption func(*PipelineFinish) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelinePlannedToPipelineFinish

func ForPipelinePlannedToPipelineFinish(e *PipelinePlanned) PipelineFinishOption

func WithPipelineOutput

func WithPipelineOutput(output *modconfig.Output) PipelineFinishOption

type PipelineFinished

type PipelineFinished struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`

	PipelineOutput map[string]interface{} `json:"pipeline_output"`
}

func NewPipelineFinished

func NewPipelineFinished(opts ...PipelineFinishedOption) (*PipelineFinished, error)

NewPipelineFinished creates a new PipelineFinished event.

func (*PipelineFinished) GetEvent

func (e *PipelineFinished) GetEvent() *Event

func (*PipelineFinished) HandlerName

func (e *PipelineFinished) HandlerName() string

type PipelineFinishedOption

type PipelineFinishedOption func(*PipelineFinished) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineFinish

func ForPipelineFinish(cmd *PipelineFinish, pipelineOutput map[string]interface{}) PipelineFinishedOption

ForPipelineFinish returns a PipelineFinishedOption that sets the fields of the PipelineFinished event from a PipelineFinish command.

type PipelineLoad

type PipelineLoad struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
}

func NewPipelineLoad

func NewPipelineLoad(opts ...PipelineLoadOption) (*PipelineLoad, error)

NewPipelineLoad creates a new PipelineLoad event.

func (*PipelineLoad) GetEvent

func (e *PipelineLoad) GetEvent() *Event

func (*PipelineLoad) HandlerName

func (e *PipelineLoad) HandlerName() string

type PipelineLoadOption

type PipelineLoadOption func(*PipelineLoad) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineQueued

func ForPipelineQueued(e *PipelineQueued) PipelineLoadOption

ForPipelineLoad returns a PipelineLoadOption that sets the fields of the PipelineLoad event from a PipelineLoad command.

type PipelineLoaded

type PipelineLoaded struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// Pipeline definition that was loaded
	Pipeline *modconfig.Pipeline `json:"pipeline"`
}

func NewPipelineLoadedFromPipelineLoad

func NewPipelineLoadedFromPipelineLoad(cmd *PipelineLoad, pipeline *modconfig.Pipeline) *PipelineLoaded

NewPipelineLoaded creates a new PipelineLoaded event.

func (*PipelineLoaded) GetEvent

func (e *PipelineLoaded) GetEvent() *Event

func (*PipelineLoaded) HandlerName

func (e *PipelineLoaded) HandlerName() string

type PipelinePause

type PipelinePause struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	ExecutionID         string `json:"execution_id,omitempty"`

	// Reason for pausing the pipeline execution
	Reason string `json:"reason,omitempty"`
}

func NewPipelinePause

func NewPipelinePause(pipelineExecutionID string, opts ...PipelinePauseOption) (*PipelinePause, error)

NewPipelineCancel creates a new PipelineCancel event.

func (*PipelinePause) GetEvent

func (e *PipelinePause) GetEvent() *Event

func (*PipelinePause) HandlerName

func (e *PipelinePause) HandlerName() string

type PipelinePauseOption

type PipelinePauseOption func(*PipelinePause) error

ExecutionOption is a function that modifies an Execution instance.

type PipelinePaused

type PipelinePaused struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	//Reason for pausing the pipeline execution
	Reason string `json:"reason,omitempty"`
}

func NewPipelinePaused

func NewPipelinePaused(opts ...PipelinePausedOption) (*PipelinePaused, error)

NewPipelineCancel creates a new PipelineCancel event.

func (*PipelinePaused) GetEvent

func (e *PipelinePaused) GetEvent() *Event

func (*PipelinePaused) HandlerName

func (e *PipelinePaused) HandlerName() string

type PipelinePausedOption

type PipelinePausedOption func(*PipelinePaused) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelinePause

func ForPipelinePause(cmd *PipelinePause) PipelinePausedOption

type PipelinePlan

type PipelinePlan struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
}

func NewPipelinePlan

func NewPipelinePlan(opts ...PipelinePlanOption) (*PipelinePlan, error)

NewPipelinePlan creates a new PipelinePlan event.

func NewPipelinePlanFromStepForEachPlanned

func NewPipelinePlanFromStepForEachPlanned(e *StepForEachPlanned) *PipelinePlan

func (*PipelinePlan) GetEvent

func (e *PipelinePlan) GetEvent() *Event

func (*PipelinePlan) HandlerName

func (e *PipelinePlan) HandlerName() string

type PipelinePlanOption

type PipelinePlanOption func(*PipelinePlan) error

ExecutionOption is a function that modifies an Execution instance.

func ForChildPipelineFinished

func ForChildPipelineFinished(e *PipelineFinished, parentPipelineExecutionID string) PipelinePlanOption

func ForPipelineResumed

func ForPipelineResumed(e *PipelineResumed) PipelinePlanOption

func ForPipelineStarted

func ForPipelineStarted(e *PipelineStarted) PipelinePlanOption

func ForPipelineStepFinished

func ForPipelineStepFinished(e *StepFinished) PipelinePlanOption

type PipelinePlanned

type PipelinePlanned struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// The planner outputs a list of the next steps to be executed in the types.
	NextSteps []modconfig.NextStep `json:"next_steps"`
}

func NewPipelinePlanned

func NewPipelinePlanned(opts ...PipelinePlannedOption) (*PipelinePlanned, error)

NewPipelinePlanned creates a new PipelinePlanned event.

func (*PipelinePlanned) GetEvent

func (e *PipelinePlanned) GetEvent() *Event

func (*PipelinePlanned) HandlerName

func (e *PipelinePlanned) HandlerName() string

type PipelinePlannedOption

type PipelinePlannedOption func(*PipelinePlanned) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelinePlan

func ForPipelinePlan(cmd *PipelinePlan) PipelinePlannedOption

ForPipelinePlan returns a PipelinePlannedOption that sets the fields of the PipelinePlanned event from a PipelinePlan command.

type PipelineQueue

type PipelineQueue struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline details
	Name string          `json:"name"`
	Args modconfig.Input `json:"args" cty:"args"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// If this is a child pipeline then set the parent pipeline execution ID
	ParentStepExecutionID string `json:"parent_step_execution_id,omitempty"`
	ParentExecutionID     string `json:"parent_execution_id,omitempty"`
}

PipelineQueue commands a pipeline to be queued for execution.

func NewPipelineQueue

func NewPipelineQueue(opts ...PipelineQueueOption) (*PipelineQueue, error)

NewPipelineQueue creates a new PipelineQueue event.

func (*PipelineQueue) GetEvent

func (e *PipelineQueue) GetEvent() *Event

func (*PipelineQueue) HandlerName

func (e *PipelineQueue) HandlerName() string

type PipelineQueueOption

type PipelineQueueOption func(*PipelineQueue) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineStepStartedToPipelineQueue

func ForPipelineStepStartedToPipelineQueue(e *StepPipelineStarted) PipelineQueueOption

ForPipelineQueue returns a PipelineQueueOption that sets the fields of the PipelineQueue event from a PipelineQueue command.

type PipelineQueued

type PipelineQueued struct {
	// Event metadata
	Event *Event `json:"event"`
	// Name of the pipeline to be queued
	Name string `json:"name"`
	// Input to the pipeline
	Args modconfig.Input `json:"args"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// If this is a child pipeline then set the parent step execution ID
	ParentStepExecutionID string `json:"parent_step_execution_id,omitempty"`
	ParentExecutionID     string `json:"parent_execution_id,omitempty"`
}

PipelineQueued is published when a pipeline is queued

func NewPipelineQueued

func NewPipelineQueued(opts ...PipelineQueuedOption) (*PipelineQueued, error)

NewPipelineQueued creates a new PipelineQueued event.

func (*PipelineQueued) GetEvent

func (e *PipelineQueued) GetEvent() *Event

func (*PipelineQueued) HandlerName

func (e *PipelineQueued) HandlerName() string

type PipelineQueuedOption

type PipelineQueuedOption func(*PipelineQueued) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineQueue

func ForPipelineQueue(cmd *PipelineQueue) PipelineQueuedOption

ForPipelineQueue returns a PipelineQueuedOption that sets the fields of the PipelineQueued event from a PipelineQueue command.

type PipelineResume

type PipelineResume struct {
	// Event metadata
	Event *Event `json:"event"`

	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	ExecutionID         string `json:"execution_id,omitempty"`

	// Reason for the cancellation
	Reason string `json:"reason,omitempty"`
}

func NewPipelineResume

func NewPipelineResume(pipelineExecutionID string, opts ...PipelineResumeOption) (*PipelineResume, error)

func (*PipelineResume) GetEvent

func (e *PipelineResume) GetEvent() *Event

func (*PipelineResume) HandlerName

func (e *PipelineResume) HandlerName() string

type PipelineResumeOption

type PipelineResumeOption func(*PipelineResume) error

ExecutionOption is a function that modifies an Execution instance.

type PipelineResumed

type PipelineResumed struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
	// Reason for the cancellation
	Reason string `json:"reason,omitempty"`
}

func NewPipelineResumedFromPipelineResume

func NewPipelineResumedFromPipelineResume(evt *PipelineResume) *PipelineResumed

NewPipelineResumed creates a new PipelineResumed event.

func (*PipelineResumed) GetEvent

func (e *PipelineResumed) GetEvent() *Event

func (*PipelineResumed) HandlerName

func (e *PipelineResumed) HandlerName() string

type PipelineStart

type PipelineStart struct {
	// Event metadata
	Event *Event `json:"event"`
	// Pipeline execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
}

func NewPipelineStart

func NewPipelineStart(opts ...PipelineStartOption) (*PipelineStart, error)

NewPipelineStart creates a new PipelineStart event.

func (*PipelineStart) GetEvent

func (e *PipelineStart) GetEvent() *Event

func (*PipelineStart) HandlerName

func (e *PipelineStart) HandlerName() string

type PipelineStartOption

type PipelineStartOption func(*PipelineStart) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineLoaded

func ForPipelineLoaded(e *PipelineLoaded) PipelineStartOption

ForPipelineStart returns a PipelineStartOption that sets the fields of the PipelineStart event from a PipelineStart command.

type PipelineStarted

type PipelineStarted struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`
}

func NewPipelineStarted

func NewPipelineStarted(opts ...PipelineStartedOption) (*PipelineStarted, error)

NewPipelineStarted creates a new PipelineStarted event.

func (*PipelineStarted) GetEvent

func (e *PipelineStarted) GetEvent() *Event

func (*PipelineStarted) HandlerName

func (e *PipelineStarted) HandlerName() string

type PipelineStartedOption

type PipelineStartedOption func(*PipelineStarted) error

ExecutionOption is a function that modifies an Execution instance.

func ForPipelineStart

func ForPipelineStart(cmd *PipelineStart) PipelineStartedOption

ForPipelineStart returns a PipelineStartedOption that sets the fields of the PipelineStarted event from a PipelineStart command.

type StepFinished

type StepFinished struct {
	// Event metadata
	Event *Event `json:"event"`
	// Step execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	StepExecutionID     string `json:"step_execution_id"`

	// Output from the primitive, this is the "native" output of the primitive
	Output *modconfig.Output `json:"output,omitempty"`

	// Step output configured from the output block, we need a separate field for this because
	// we don't want the StepOutput accidentally override the native primtive outputs
	StepOutput map[string]interface{} `json:"step_output,omitempty"`

	// loop controls
	StepForEach *modconfig.StepForEach `json:"step_for_each,omitempty"`
	StepLoop    *modconfig.StepLoop    `json:"step_loop,omitempty"`
	StepRetry   *modconfig.StepRetry   `json:"step_retry,omitempty"`
}

StepFinished event is when a step (any step step has completed). This is an event that will be handled by an Event Handler (StepFinishedHandler)

Do not confuse this with Pipeline Step Finish **command** which is raised when a child pipeline has finished

func NewStepFinished

func NewStepFinished(opts ...StepFinishedOption) (*StepFinished, error)

NewStepFinished creates a new StepFinished event.

func NewStepFinishedFromStepStart

func NewStepFinishedFromStepStart(cmd *StepStart, output *modconfig.Output, stepOutput map[string]interface{}, stepLoop *modconfig.StepLoop) (*StepFinished, error)

func (*StepFinished) GetEvent

func (e *StepFinished) GetEvent() *Event

func (*StepFinished) HandlerName

func (e *StepFinished) HandlerName() string

type StepFinishedOption

type StepFinishedOption func(*StepFinished) error

func ForPipelineStepFinish

func ForPipelineStepFinish(cmd *StepPipelineFinish) StepFinishedOption

type StepForEachPlan

type StepForEachPlan struct {
	Event               *Event `json:"event"`
	PipelineExecutionID string `json:"pipeline_execution_id"`
	StepName            string `json:"step_name"`
}

func NewStepForEachPlanFromPipelinePlanned

func NewStepForEachPlanFromPipelinePlanned(e *PipelinePlanned, stepName string) *StepForEachPlan

func NewStepForEachPlanFromPipelineStepFinished

func NewStepForEachPlanFromPipelineStepFinished(e *StepFinished, stepName string) *StepForEachPlan

func (*StepForEachPlan) GetEvent

func (e *StepForEachPlan) GetEvent() *Event

func (*StepForEachPlan) HandlerName

func (e *StepForEachPlan) HandlerName() string

type StepForEachPlanned

type StepForEachPlanned struct {
	Event               *Event               `json:"event"`
	StepName            string               `json:"step_name"`
	PipelineExecutionID string               `json:"pipeline_execution_id"`
	NextSteps           []modconfig.NextStep `json:"next_steps"`
}

func NewStepForEachPlannedFromStepForEachPlan

func NewStepForEachPlannedFromStepForEachPlan(cmd *StepForEachPlan, nextSteps []modconfig.NextStep) *StepForEachPlanned

func (*StepForEachPlanned) GetEvent

func (e *StepForEachPlanned) GetEvent() *Event

func (*StepForEachPlanned) HandlerName

func (e *StepForEachPlanned) HandlerName() string

type StepPipelineFinish

type StepPipelineFinish struct {
	// Event metadata
	Event *Event `json:"event"`
	// Step execution details
	PipelineExecutionID string            `json:"pipeline_execution_id"`
	StepExecutionID     string            `json:"step_execution_id"`
	Output              *modconfig.Output `json:"output,omitempty"`

	// for_each controls
	StepForEach *modconfig.StepForEach `json:"step_for_each,omitempty"`
	StepLoop    *modconfig.StepLoop    `json:"step_loop,omitempty"`
	StepRetry   *modconfig.StepRetry   `json:"step_retry,omitempty"`
	StepInput   modconfig.Input        `json:"step_input,omitempty"`
}

There's only one use case for this, which is to handle the "Pipeline Step" finish **command**.

Do not confuse/conflate this with the step_finished **event** which is raised when a step has finished.

func NewStepPipelineFinish

func NewStepPipelineFinish(opts ...StepPipelineFinishOption) (*StepPipelineFinish, error)

NewStepPipelineFinish creates a new StepPipelineFinish event.

func (*StepPipelineFinish) GetEvent

func (e *StepPipelineFinish) GetEvent() *Event

func (*StepPipelineFinish) HandlerName

func (e *StepPipelineFinish) HandlerName() string

type StepPipelineFinishOption

type StepPipelineFinishOption func(*StepPipelineFinish) error

func WithPipelineExecutionID

func WithPipelineExecutionID(id string) StepPipelineFinishOption

func WithStepExecutionID

func WithStepExecutionID(id string) StepPipelineFinishOption

func WithStepForEach

func WithStepForEach(stepForEach *modconfig.StepForEach) StepPipelineFinishOption

type StepPipelineStarted

type StepPipelineStarted struct {
	// Event metadata
	Event *Event `json:"event"`
	// Step execution details
	PipelineExecutionID string `json:"pipeline_execution_id"`
	StepExecutionID     string `json:"step_execution_id"`
	// Optional details for step execution
	ChildPipelineExecutionID string          `json:"child_pipeline_execution_id,omitempty"`
	ChildPipelineName        string          `json:"child_pipeline_name,omitempty"`
	ChildPipelineArgs        modconfig.Input `json:"child_pipeline_args,omitempty"`

	// The key for a single step is always "0" but say this pipeline step start is part of for_each, the key is
	// populated with the actual key: "0"/"1"/"2" or "foo"/"bar"/"baz" (for map based for_each)
	//
	// This key is only relevant to its immediate parent (if we have multiple nested pipelines)
	Key string `json:"key"`
}

! This event is only for starting Pipeline Step, not a general step start command. ! ! For general Step Start command, refer to StepStart

func NewStepPipelineStarted

func NewStepPipelineStarted(opts ...StepPipelineStartedOption) (*StepPipelineStarted, error)

NewStepPipelineStarted creates a new StepPipelineStarted event.

func (*StepPipelineStarted) GetEvent

func (e *StepPipelineStarted) GetEvent() *Event

func (*StepPipelineStarted) HandlerName

func (e *StepPipelineStarted) HandlerName() string

type StepPipelineStartedOption

type StepPipelineStartedOption func(*StepPipelineStarted) error

func ForStepStart

func ForStepStart(cmd *StepStart) StepPipelineStartedOption

func WithChildPipeline

func WithChildPipeline(name string, args modconfig.Input) StepPipelineStartedOption

func WithChildPipelineExecutionID

func WithChildPipelineExecutionID(id string) StepPipelineStartedOption

WithChildPipelineExecutionID returns a PipelineStepStartedOption that sets the ChildPipelineExecutionID to the given ID.

func WithNewChildPipelineExecutionID

func WithNewChildPipelineExecutionID() StepPipelineStartedOption

WithNewChildPipelineExecutionID returns a PipelineStepStartedOption that sets the ChildPipelineExecutionID to a new ID.

type StepQueue

type StepQueue struct {
	// Event metadata
	Event *Event `json:"event"`
	// Step execution details
	PipelineExecutionID string          `json:"pipeline_execution_id"`
	StepExecutionID     string          `json:"step_execution_id"`
	StepName            string          `json:"step_name"`
	StepInput           modconfig.Input `json:"input"`

	// for_each controls
	StepForEach *modconfig.StepForEach `json:"step_for_each,omitempty"`
	StepLoop    *modconfig.StepLoop    `json:"step_loop,omitempty"`
	StepRetry   *modconfig.StepRetry   `json:"step_retry,omitempty"`

	NextStepAction modconfig.NextStepAction `json:"action,omitempty"`
}

func NewStepQueue

func NewStepQueue(opts ...StepQueueOption) (*StepQueue, error)

NewStepQueue creates a new StepQueue event.

func NewStepQueueFromPipelineStepFinishedForLoop

func NewStepQueueFromPipelineStepFinishedForLoop(e *StepFinished, stepName string) *StepQueue

func NewStepQueueFromPipelineStepFinishedForRetry

func NewStepQueueFromPipelineStepFinishedForRetry(e *StepFinished, stepName string) *StepQueue

func NewStepQueueFromStepForEachPlanned

func NewStepQueueFromStepForEachPlanned(e *StepForEachPlanned, nextStep *modconfig.NextStep) (*StepQueue, error)

func (*StepQueue) GetEvent

func (e *StepQueue) GetEvent() *Event

func (*StepQueue) HandlerName

func (e *StepQueue) HandlerName() string

type StepQueueOption

type StepQueueOption func(*StepQueue) error

func StepQueueForPipelinePlanned

func StepQueueForPipelinePlanned(e *PipelinePlanned) StepQueueOption

func StepQueueWithStep

func StepQueueWithStep(name string, input modconfig.Input, stepForEach *modconfig.StepForEach, stepLoop *modconfig.StepLoop, nextStepAction modconfig.NextStepAction) StepQueueOption

type StepQueued

type StepQueued struct {
	// Event metadata
	Event *Event `json:"event"`
	// Unique identifier for this pipeline execution
	PipelineExecutionID string `json:"pipeline_execution_id"`

	StepExecutionID string          `json:"step_execution_id"`
	StepName        string          `json:"step_name"`
	StepType        string          `json:"step_type"`
	StepInput       modconfig.Input `json:"input"`

	// for_each controls
	StepForEach    *modconfig.StepForEach   `json:"step_for_each,omitempty"`
	StepLoop       *modconfig.StepLoop      `json:"step_loop,omitempty"`
	StepRetry      *modconfig.StepRetry     `json:"step_retry,omitempty"`
	NextStepAction modconfig.NextStepAction `json:"next_step_action,omitempty"`
}

func NewStepQueued

func NewStepQueued(opts ...StepQueuedOption) (*StepQueued, error)

NewStepQueued creates a new StepQueued event.

func (*StepQueued) GetEvent

func (e *StepQueued) GetEvent() *Event

func (*StepQueued) HandlerName

func (e *StepQueued) HandlerName() string

type StepQueuedOption

type StepQueuedOption func(*StepQueued) error

func ForStepQueue

func ForStepQueue(cmd *StepQueue) StepQueuedOption

type StepStart

type StepStart struct {
	// Event metadata
	Event *Event `json:"event"`
	// Step execution details
	PipelineExecutionID string          `json:"pipeline_execution_id"`
	StepExecutionID     string          `json:"step_execution_id"`
	StepName            string          `json:"step_name"`
	StepType            string          `json:"step_type"`
	StepInput           modconfig.Input `json:"input"`

	// for_each controls
	StepForEach *modconfig.StepForEach `json:"step_for_each,omitempty"`
	StepLoop    *modconfig.StepLoop    `json:"step_loop,omitempty"`
	StepRetry   *modconfig.StepRetry   `json:"step_retry,omitempty"`

	NextStepAction modconfig.NextStepAction `json:"next_step_action,omitempty"`
}

func NewStepStart

func NewStepStart(opts ...StepStartOption) (*StepStart, error)

NewStepStart creates a new StepStart command.

func NewStepStartFromStepQueued

func NewStepStartFromStepQueued(e *StepQueued) (*StepStart, error)

func (*StepStart) GetEvent

func (e *StepStart) GetEvent() *Event

func (*StepStart) HandlerName

func (e *StepStart) HandlerName() string

type StepStartOption

type StepStartOption func(*StepStart) error

func ForPipelinePlanned

func ForPipelinePlanned(e *PipelinePlanned) StepStartOption

func WithStepLoop

func WithStepLoop(stepLoop *modconfig.StepLoop) StepStartOption

Jump to

Keyboard shortcuts

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