models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ContainerState

type ContainerState string
const (
	ContainerStateUnknown    ContainerState = "UNKNOWN"    // Unknown state, should never be in this state.
	ContainerStateProcessing ContainerState = "PROCESSING" // Pre-scheduling validation and prep.
	ContainerStateWaiting    ContainerState = "WAITING"    // Waiting to be scheduled.
	ContainerStateRunning    ContainerState = "RUNNING"    // Currently running as reported by scheduler.
	ContainerStateFailed     ContainerState = "FAILED"     // Has encountered an issue, either container issue or scheduling issue.
	ContainerStateSuccess    ContainerState = "SUCCESS"    // Finished with a proper error code.
	ContainerStateCancelled  ContainerState = "CANCELLED"  // Cancelled mid run due to user requested cancellation.
	ContainerStateSkipped    ContainerState = "SKIPPED"    // Not run due to dependencies not being met.
)

type Event added in v0.1.0

type Event interface {
	GetID() int64
	SetID(id int64)
	GetKind() EventType
	GetEmitted() int64
}

type EventAbandonedPipeline added in v0.1.0

type EventAbandonedPipeline struct {
	Metadata
	NamespaceID string
	PipelineID  string
}

func NewEventAbandonedPipeline added in v0.1.0

func NewEventAbandonedPipeline(pipeline Pipeline) *EventAbandonedPipeline

func (*EventAbandonedPipeline) ToProto added in v0.1.0

type EventCompletedRun added in v0.1.0

type EventCompletedRun struct {
	Metadata
	NamespaceID string
	PipelineID  string
	RunID       int64
	State       RunState
}

func NewEventCompletedRun added in v0.1.0

func NewEventCompletedRun(run Run) *EventCompletedRun

func (*EventCompletedRun) ToProto added in v0.1.0

type EventCompletedTaskRun added in v0.1.0

type EventCompletedTaskRun struct {
	Metadata
	NamespaceID string
	PipelineID  string
	RunID       int64
	TaskRunID   string
	State       ContainerState
}

func NewEventCompletedTaskRun added in v0.1.0

func NewEventCompletedTaskRun(taskrun TaskRun) *EventCompletedTaskRun

func (*EventCompletedTaskRun) ToProto added in v0.1.0

type EventCreatedNamespace added in v0.1.0

type EventCreatedNamespace struct {
	Metadata
	NamespaceID string
}

func NewEventCreatedNamespace added in v0.1.0

func NewEventCreatedNamespace(namespace Namespace) *EventCreatedNamespace

func (*EventCreatedNamespace) ToProto added in v0.1.0

type EventCreatedPipeline added in v0.1.0

type EventCreatedPipeline struct {
	Metadata
	NamespaceID string
	PipelineID  string
}

func NewEventCreatedPipeline added in v0.1.0

func NewEventCreatedPipeline(pipeline Pipeline) *EventCreatedPipeline

func (*EventCreatedPipeline) ToProto added in v0.1.0

type EventDisabledPipeline added in v0.1.0

type EventDisabledPipeline struct {
	Metadata
	NamespaceID string
	PipelineID  string
}

func NewEventDisabledPipeline added in v0.1.0

func NewEventDisabledPipeline(pipeline Pipeline) *EventDisabledPipeline

func (*EventDisabledPipeline) ToProto added in v0.1.0

type EventEnabledPipeline added in v0.1.0

type EventEnabledPipeline struct {
	Metadata
	NamespaceID string
	PipelineID  string
}

func NewEventEnabledPipeline added in v0.1.0

func NewEventEnabledPipeline(pipeline Pipeline) *EventEnabledPipeline

func (*EventEnabledPipeline) ToProto added in v0.1.0

type EventFiredTrigger added in v0.1.0

type EventFiredTrigger struct {
	Metadata
	Label           string
	Pipeline        string
	Namespace       string
	Result          TriggerResult
	TriggerMetadata map[string]string // Environment variables to be passed on to the pending run.
}

func NewEventFiredTrigger added in v0.1.0

func NewEventFiredTrigger(namespace, pipeline, label string, result TriggerResult, metadata map[string]string) *EventFiredTrigger

func (*EventFiredTrigger) ToProto added in v0.1.0

type EventProcessedTrigger added in v0.1.0

type EventProcessedTrigger struct {
	Metadata
	Label           string
	Pipeline        string
	Namespace       string
	Result          TriggerResult
	TriggerMetadata map[string]string // Environment variables to be passed on to the pending run.
}

func NewEventProcessedTrigger added in v0.1.0

func NewEventProcessedTrigger(namespace, pipeline, label string, result TriggerResult, metadata map[string]string) *EventProcessedTrigger

func (*EventProcessedTrigger) ToProto added in v0.1.0

type EventResolvedTrigger added in v0.1.0

type EventResolvedTrigger struct {
	Metadata
	Label           string
	Pipeline        string
	Namespace       string
	Result          TriggerResult
	TriggerMetadata map[string]string // Environment variables to be passed on to the pending run.
}

func NewEventResolvedTrigger added in v0.1.0

func NewEventResolvedTrigger(namespace, pipeline, label string, result TriggerResult, metadata map[string]string) *EventResolvedTrigger

func (*EventResolvedTrigger) FromProto added in v0.1.0

func (*EventResolvedTrigger) ToProto added in v0.1.0

type EventScheduledTaskRun added in v0.1.0

type EventScheduledTaskRun struct {
	Metadata
	NamespaceID string
	PipelineID  string
	RunID       int64
	TaskRunID   string
}

func NewEventScheduledTaskRun added in v0.1.0

func NewEventScheduledTaskRun(taskrun TaskRun) *EventScheduledTaskRun

func (*EventScheduledTaskRun) ToProto added in v0.1.0

type EventStartedRun added in v0.1.0

type EventStartedRun struct {
	Metadata
	NamespaceID string
	PipelineID  string
	RunID       int64
}

func NewEventStartedRun added in v0.1.0

func NewEventStartedRun(run Run) *EventStartedRun

func (*EventStartedRun) ToProto added in v0.1.0

func (e *EventStartedRun) ToProto() *proto.EventStartedRun

type EventStartedTaskRun added in v0.1.0

type EventStartedTaskRun struct {
	Metadata
	NamespaceID string
	PipelineID  string
	RunID       int64
	TaskRunID   string
}

func NewEventStartedTaskRun added in v0.1.0

func NewEventStartedTaskRun(taskrun TaskRun) *EventStartedTaskRun

func (*EventStartedTaskRun) ToProto added in v0.1.0

type EventType added in v0.1.0

type EventType string
const (
	// AnyEvent is a special event type the denotes the caller wants to listen for any event. It should not be used
	// as a normal event type (for example do not publish anything with it).
	// The AnyEvent type is internal only.
	AnyEvent EventType = "*"

	// Namespace events
	CreatedNamespaceEvent EventType = "CREATED_NAMESPACE"

	// Pipeline events
	DisabledPipelineEvent  EventType = "DISABLED_PIPELINE"
	EnabledPipelineEvent   EventType = "ENABLED_PIPELINE"
	CreatedPipelineEvent   EventType = "CREATED_PIPELINE"
	AbandonedPipelineEvent EventType = "ABANDONED_PIPELINE"

	// Run events
	StartedRunEvent   EventType = "STARTED_RUN"
	CompletedRunEvent EventType = "COMPLETED_RUN"

	// TaskRun events
	StartedTaskRunEvent   EventType = "STARTED_TASK_RUN"   // Task run is getting ready to be scheduled.
	ScheduledTaskRunEvent EventType = "SCHEDULED_TASK_RUN" // Task run has been attempted to be scheduled.
	CompletedTaskRunEvent EventType = "COMPLETED_TASK_RUN" // Task run has completed.

	// Trigger events; these are all from the perspective of the Gofer main process.
	FiredTriggerEvent     EventType = "FIRED_TRIGGER"     // Received a new trigger event.
	ProcessedTriggerEvent EventType = "PROCESSED_TRIGGER" // Currently processing a trigger event that was fired.
	ResolvedTriggerEvent  EventType = "RESOLVED_TRIGGER"  // Successfully processed the trigger.
)

type HCLPipelineConfig

type HCLPipelineConfig struct {
	ID          string                     `hcl:"id"`
	Description string                     `hcl:"description,optional"`
	Name        string                     `hcl:"name"`
	Namespace   string                     `hcl:"namespace,optional"`  // Namespace pipeline will belong to, if empty is set to "default".
	Sequential  bool                       `hcl:"sequential,optional"` // Restrict pipeline to only one run at a time.
	Tasks       []HCLPipelineTaskConfig    `hcl:"task,block"`          // Each task represents a unit of work wrapped in a docker container.
	Triggers    []HCLPipelineTriggerConfig `hcl:"trigger,block"`       // Each trigger represents an automated way to start a pipeline.
}

HCLPipelineConfig represents the structure of a pipeline configuration file in HCL form.

func (*HCLPipelineConfig) FromBytes

func (config *HCLPipelineConfig) FromBytes(content []byte, filename string) error

FromBytes attempts to parse a given HCL configuration. The filename param is for passing back to the user on error.

func (*HCLPipelineConfig) Validate

func (config *HCLPipelineConfig) Validate() error

Validate examines the HCL pipeline configuration to make sure it adheres to best practices and formatting mistakes.

type HCLPipelineRegistryAuthConfig added in v0.0.3

type HCLPipelineRegistryAuthConfig struct {
	User string `json:"user" hcl:"user,optional"`
	Pass string `json:"pass" hcl:"pass,optional"`
}

type HCLPipelineTaskConfig

type HCLPipelineTaskConfig struct {
	ID          string            `json:"id" hcl:"id,label"`
	ImageName   string            `json:"image_name" hcl:"image_name,label"`
	Description string            `json:"description" hcl:"description,optional"`
	DependsOn   map[string]string `json:"depends_on" hcl:"depends_on,optional"`
	EnvVars     map[string]string `json:"env_vars" hcl:"env_vars,optional"`

	// HCLv2 has many idiosyncrasies, but this one is noteworthy for future reference. The only way to make a block
	// optional is to make the type a reference to the real struct and then make sure to check for the possible nil.
	RegistryAuth *HCLPipelineRegistryAuthConfig `json:"registry_auth" hcl:"registry_auth,block"`
}

func (*HCLPipelineTaskConfig) Validate

func (config *HCLPipelineTaskConfig) Validate() error

type HCLPipelineTriggerConfig

type HCLPipelineTriggerConfig struct {
	Kind   string         `hcl:"kind,label"`    // The trigger name/id.
	Label  string         `hcl:"label,label"`   // the user defined name for the trigger.
	Config hcl.Attributes `hcl:"config,remain"` // Any configuration the trigger might need per pipeline.
}

HCLPipelineTriggerConfig is a representation of a trigger within the pipeline configuration. There could be more than one trigger.

func (*HCLPipelineTriggerConfig) Validate

func (config *HCLPipelineTriggerConfig) Validate() error

type Metadata added in v0.1.0

type Metadata struct {
	EventID int64     `json:"event_id" storm:"id,increment"` // Unique identifier for event
	Kind    EventType `json:"kind"`                          // the type of event it is disabled_pipeline
	Emitted int64     `json:"emitted"`                       // Time event was performed in epoch milliseconds.
}

func NewMetadata added in v0.1.0

func NewMetadata(kind EventType) Metadata

func (*Metadata) FromProto added in v0.1.0

func (m *Metadata) FromProto(p *proto.Metadata)

func (*Metadata) GetEmitted added in v0.1.0

func (m *Metadata) GetEmitted() int64

func (*Metadata) GetID added in v0.1.0

func (m *Metadata) GetID() int64

func (*Metadata) GetKind added in v0.1.0

func (m *Metadata) GetKind() EventType

func (*Metadata) SetID added in v0.1.0

func (m *Metadata) SetID(id int64)

func (*Metadata) ToProto added in v0.1.0

func (m *Metadata) ToProto() *proto.Metadata

type Namespace

type Namespace struct {
	ID          string `json:"id" storm:"id"` // Unique identifier; user defined.
	Name        string `json:"name"`          // Humanized name; great for reading from UIs.
	Description string `json:"description"`   // Short description on what name space is used for.
	Created     int64  `json:"created"`       // The creation time in epoch milli.
	Deleted     int64  `json:"deleted"`       // The deletion time in epoch milli; 0 if not deleted.

}

Namespace represents a division of pipelines. Normally it is used to divide teams or logically different sections of workloads. It is the highest level unit.

func NewNamespace

func NewNamespace(id, name, description string) *Namespace

func (*Namespace) FromProto

func (n *Namespace) FromProto(proto *proto.Namespace)

func (*Namespace) ToProto

func (n *Namespace) ToProto() *proto.Namespace

type Pipeline

type Pipeline struct {
	// Location points to where the pipeline might have been received from. Gofer has the ability to get pipeline files
	// via URL or by bytes.
	//
	// If by URL, the value accepted here conforms to the hashicorp go-getter URL formatter:
	// https://github.com/hashicorp/go-getter#protocol-specific-options
	Location string `json:"location"`

	Created     int64  `json:"created" storm:"index"` // Time pipeline was created in epoch milliseconds.
	Description string `json:"description"`           // Description of pipeline's purpose and other details.
	ID          string `json:"id" storm:"id"`         // Unique identifier; user defined.
	Namespace   string `json:"namespace"`             // The namespace this pipeline belongs to.
	LastRunTime int64  `json:"last_run_time"`         // Last time a run was triggered for this pipeline.
	LastRunID   int64  `json:"last_run_id"`           // The ID of the most recent run.
	Updated     int64  `json:"updated"`               // Modified time in epoch millisecs. User initiated changes only.
	Name        string `json:"name"`                  // Name refers to a human readable pipeline name.
	Sequential  bool   `json:"sequential"`            // Only run one job at a time.
	// The current running state of the pipeline. This is used to determine if the pipeline should continue to process
	// runs or not and properly convey that to the user.
	State PipelineState   `json:"state"`
	Tasks map[string]Task `json:"tasks"` // Map for quickly finding pipeline tasks and assists with DAG generation.

	// Triggers is a listing of trigger labels to the their trigger subscription objects
	Triggers map[string]PipelineTriggerConfig `json:"triggers"`
	Objects  []string                         `json:"objects"` // Object keys that are stored at the pipeline level.
}

Pipeline is a representation of a collection of logically grouped tasks. A task is a unit of work wrapped in a docker container. Pipeline is a secondary level unit being contained within pipelines and containing tasks.

func NewPipeline

func NewPipeline(location string, pipelineConfig *PipelineConfig) *Pipeline

func (*Pipeline) FromConfig

func (p *Pipeline) FromConfig(config *PipelineConfig)

func (*Pipeline) FromProto

func (p *Pipeline) FromProto(proto *proto.Pipeline)

func (*Pipeline) IsOperational

func (p *Pipeline) IsOperational() bool

IsOperational returns whether or not the pipeline is in a state capable of launching new runs.

func (*Pipeline) ToProto

func (p *Pipeline) ToProto() *proto.Pipeline

type PipelineConfig

type PipelineConfig struct {
	ID          string
	Description string
	Name        string
	Namespace   string                  // Unique ID for namespace pipeline will belong to.
	Sequential  bool                    // Restrict pipeline to only one run at a time.
	Tasks       []Task                  // Each task represents a unit of work wrapped in a docker container.
	Triggers    []PipelineTriggerConfig // Each trigger represents an automated way to start a pipeline.
}

PipelineConfig is the representation of pipeline configuration without HCL elements.

func FromHCL

func FromHCL(hcl *HCLPipelineConfig) (*PipelineConfig, error)

FromHCL returns a normal config struct from a given HCLConfig struct

type PipelineState

type PipelineState string
const (
	PipelineStateUnknown  PipelineState = "UNKNOWN"
	PipelineStateActive   PipelineState = "ACTIVE"
	PipelineStateDisabled PipelineState = "DISABLED"

	// When a pipeline is abandoned it unsubscribes from all triggers and can no longer be used.
	PipelineStateAbandoned PipelineState = "ABANDONED"
)

type PipelineTriggerConfig

type PipelineTriggerConfig struct {
	Kind   string            // The trigger name/id.
	Label  string            // Custom identifier for the trigger.
	Config map[string]string // Any configuration the trigger might need per pipeline.
	// Trigger subscriptions might be unable to be created, in this instance we need to set the
	// state of the trigger so that the user can understand why there might be a problem with their pipeline.
	State PipelineTriggerState
}

PipelineTriggerConfig is the representation of the pipeline trigger configuration without HCL elements.

type PipelineTriggerState added in v0.0.3

type PipelineTriggerState string
const (
	PipelineTriggerStateUnknown     PipelineTriggerState = "UNKNOWN"
	PipelineTriggerStateActive      PipelineTriggerState = "ACTIVE"
	PipelineTriggerStateDisabled    PipelineTriggerState = "DISABLED"
	PipelineTriggerStateUnsupported PipelineTriggerState = "UNSUPPORTED"
)

type RegistryAuth added in v0.0.3

type RegistryAuth struct {
	User string `json:"user"`
	Pass string `json:"pass"`
}

func (*RegistryAuth) ToProto added in v0.0.3

func (r *RegistryAuth) ToProto() *proto.RegistryAuth

type RequiredParentState

type RequiredParentState string
const (
	RequiredParentStateUnknown RequiredParentState = "UNKNOWN"
	RequiredParentStateAny     RequiredParentState = "ANY"
	RequiredParentStateSuccess RequiredParentState = "SUCCESSFUL"
	RequiredParentStateFail    RequiredParentState = "FAILURE"
)

type Run

type Run struct {
	Ended       int64      `json:"ended"`                   // Time of run finish in epoch milli.
	Failure     RunFailure `json:"failure"`                 // Details about a failed run.
	ID          int64      `json:"id" storm:"id,increment"` // UniqueID of a run. Autoincrementing and cannot be zero.
	NamespaceID string     `json:"namespace_id"`            // Unique ID of namespace.
	PipelineID  string     `json:"pipeline_id"`             // The unique ID of the related pipeline.
	Started     int64      `json:"started"`                 // Time of run start in epoch milli.
	State       RunState   `json:"status"`                  // The current state of the run.
	TaskRuns    []string   `json:"task_runs"`               // The unique ID of each task run.

	// Allows the ability to only launch a run with specific tasks mentioned in this list.
	Only        map[string]struct{} `json:"only"`
	TriggerKind string              `json:"trigger_kind"` // The id/name of the trigger used to initiate this run.
	TriggerName string              `json:"trigger_name"` // The user defined name of the trigger used to initiate this run.

	// Env vars to be injected into each child task run. These are usually taken from a trigger.
	Variables      map[string]string `json:"variables"`
	Objects        []string          `json:"objects"`         // Object keys that are stored at the run level.
	ObjectsExpired bool              `json:"objects_expired"` // Tracks whether objects for this run have expired already.
}

Run represents one or more tasks being executed on behalf of some trigger(manual or otherwise). Run is a third level unit being contained within pipelines.

func NewRun

func NewRun(pipelineID, namespaceID, triggerKind, triggerName string, taskFilter map[string]struct{}, vars map[string]string) *Run

func (*Run) FromProto

func (r *Run) FromProto(proto *proto.Run)

func (*Run) IsComplete

func (r *Run) IsComplete() bool

IsComplete returns whether the run has completed and no further state changes will be made.

func (*Run) SetCancelled

func (r *Run) SetCancelled(description string)

func (*Run) SetFailed

func (r *Run) SetFailed(kind RunFailureKind, description string)

SetFailed updates the run with the appropriate parameters should a run fail. Only updates it in memory, a call to storage to save it is still needed.

func (*Run) SetSucceeded

func (r *Run) SetSucceeded()

func (*Run) ToProto

func (r *Run) ToProto() *proto.Run

type RunFailure

type RunFailure struct {
	Kind        RunFailureKind `json:"kind"`        // The specific type of run failure. Good for documentation about what it might be.
	Description string         `json:"description"` // The description of why the run might have failed.
}

type RunFailureKind

type RunFailureKind string
const (
	RunFailureKindUnknown            RunFailureKind = "UNKNOWN"             // The failure is for unknown reasons.
	RunFailureKindAbnormalExit       RunFailureKind = "ABNORMAL_EXIT"       // Run could not complete successfully.
	RunFailureKindSchedulerError     RunFailureKind = "SCHEDULER_ERROR"     // Run could not be scheduled properly.
	RunFailureKindFailedPrecondition RunFailureKind = "FAILED_PRECONDITION" // Run parameters were not acceptable.
	RunFailureKindCancelled          RunFailureKind = "CANCELLED"           // Run or child task runs were cancelled due to user action.
)

type RunState

type RunState string
const (
	RunUnknown    RunState = "UNKNOWN"    // The state of the run is unknown.
	RunProcessing RunState = "PROCESSING" // Going through validation checks in preparation for scheduling.
	RunWaiting    RunState = "WAITING"    // Waiting to be scheduled.
	RunRunning    RunState = "RUNNING"    // Currently running.
	RunFailed     RunState = "FAILED"     // Encountered an issue either in scheduling or with the container application.
	RunSuccess    RunState = "SUCCESS"    // Finished with a proper error code.
	RunCancelled  RunState = "CANCELLED"  // Cancelled by the user action.
)

type Task

type Task struct {
	ID           string                         `json:"id"`
	Description  string                         `json:"description"`
	Image        string                         `json:"image"`
	RegistryAuth RegistryAuth                   `json:"registry_auth"`
	DependsOn    map[string]RequiredParentState `json:"depends_on"`
	EnvVars      map[string]string              `json:"env_vars"`
}

func (*Task) ToProto

func (r *Task) ToProto() *proto.Task

type TaskRun

type TaskRun struct {
	Created     int64          `json:"created" storm:"index"` // Time of task run creation in epoch milliseconds.
	Ended       int64          `json:"ended"`                 // Time of task run completion in epoch milliseconds.
	ExitCode    int            `json:"exit_code"`             // The exit code of the task run.
	Failure     TaskRunFailure `json:"failure"`               // Detailed reasoning on task run failure.
	ID          string         `json:"id" storm:"id"`         // Unique ID for task run; taken from the taskID.
	LogsExpired bool           `json:"logs_expired"`          // If the logs have past their retention time.

	// If the logs have been removed. This can be due to user request or automatic action based on expiry time.
	LogsRemoved bool   `json:"logs_removed"`
	NamespaceID string `json:"namespace_id"` // Unique identifier for namespace.
	PipelineID  string `json:"pipeline_id"`  // Unique pipeline ID of task run.
	RunID       int64  `json:"run_id"`       // Unique run ID of task run; sequential.

	// The identifier used by the scheduler to identify this specific task run container. This is provided by the
	// scheduler.
	SchedulerID string         `json:"scheduler_id"`
	Started     int64          `json:"started" storm:"index"` // Time of task run actual start in epoch milliseconds.
	State       ContainerState `json:"status"`
	Task        `json:"task"`  // Task information.
}

TaskRun is a specific execution of a task/container. It represents a 4th level unit in the hierarchy: namespace -> pipeline -> run -> taskrun.

func NewTaskRun

func NewTaskRun(run Run, task Task) *TaskRun

func (*TaskRun) FromProto

func (r *TaskRun) FromProto(proto *proto.TaskRun)

func (*TaskRun) IsComplete

func (r *TaskRun) IsComplete() bool

IsComplete returns whether the task run has completed and no further state changes will be made.

func (*TaskRun) SetFinishedAbnormal

func (r *TaskRun) SetFinishedAbnormal(state ContainerState, failure TaskRunFailure, code int)

func (*TaskRun) SetFinishedSuccess

func (r *TaskRun) SetFinishedSuccess()

func (*TaskRun) ToProto

func (r *TaskRun) ToProto() *proto.TaskRun

type TaskRunFailure

type TaskRunFailure struct {
	Kind        TaskRunFailureKind `json:"kind"`        // Specific failure type; useful for documentation.
	Description string             `json:"description"` // Details on why the task run failed.
}

type TaskRunFailureKind

type TaskRunFailureKind string
const (
	TaskRunFailureKindUnknown            TaskRunFailureKind = "UNKNOWN"             // Unknown state, should never be in this state.
	TaskRunFailureKindAbnormalExit       TaskRunFailureKind = "ABNORMAL_EXIT"       // A non-zero exit code has been received.
	TaskRunFailureKindSchedulerError     TaskRunFailureKind = "SCHEDULER_ERROR"     // Encountered an error with the backend scheduler.
	TaskRunFailureKindFailedPrecondition TaskRunFailureKind = "FAILED_PRECONDITION" // User error in task run parameters.
	TaskRunFailureKindCancelled          TaskRunFailureKind = "CANCELLED"           // User invoked cancellation.
	TaskRunFailureKindOrphaned           TaskRunFailureKind = "ORPHANED"            // Task run was lost due to extreme internal error.
)

type Token

type Token struct {
	Created    int64             `json:"created"`         // Create time in epoch millisecond
	Hash       string            `json:"hash" storm:"id"` // SHA-256 hash of the secret ID.
	Kind       TokenKind         `json:"kind"`            // The type of token. Management tokens are essentially root.
	Namespaces []string          `json:"namespaces"`      // List of namespaces this token has access to.
	Metadata   map[string]string `json:"metadata"`        // Extra information about this token in label form.
}

Token is a representation of the API key, belonging to an owner.

func NewToken

func NewToken(hash string, kind TokenKind, namespaces []string, metadata map[string]string) *Token

func (*Token) ToProto

func (t *Token) ToProto() *proto.Token

type TokenKind

type TokenKind string
const (
	TokenKindUnknown    TokenKind = "UNKNOWN"
	TokenKindManagement TokenKind = "MANAGEMENT"
	TokenKindClient     TokenKind = "CLIENT"
)

type Trigger

type Trigger struct {
	// Key is a trigger's authentication key used to validate requests from the Gofer main service.
	// On every request the Gofer service passes this key so that it is impossible for other service to contact
	// and manipulate triggers directly.
	Key string `json:"-"`

	// Kind is a unique identifier for the trigger usually in plain english.
	Kind string `json:"kind" storm:"id,unique"`

	// URL is the network address used to communicate with the trigger by the main process.
	URL string `json:"url"`

	// SchedulerID is an identifier used by the scheduler to point out which container this trigger is mapped to. Used
	// when manipulating the container through the identifier.
	SchedulerID   string         `json:"scheduler_id"`
	Started       int64          `json:"started"` // The start time of the trigger in epoch milliseconds.
	State         ContainerState `json:"state"`
	Documentation string         `json:"documentation"` // The documentation link for this specific trigger.
}

func (*Trigger) ToProto

func (t *Trigger) ToProto() *proto.Trigger

type TriggerResult

type TriggerResult struct {
	Details string // details about the trigger's current result.
	State   TriggerResultState
}

func (*TriggerResult) FromProto added in v0.1.0

func (t *TriggerResult) FromProto(p *proto.TriggerResult)

func (*TriggerResult) ToProto added in v0.1.0

func (t *TriggerResult) ToProto() *proto.TriggerResult

type TriggerResultState

type TriggerResultState string

TriggerResultState is a description of an events specific outcome. Events are normally generated by triggers so its helpful to have them be able to pass down an event but also give an indication on what that event might mean.

For example: A trigger that evaluates whether a pipeline should run on a specific date might also skip certain holidays. In this case it would pass down an "skipped" event result to inform the user that their pipeline would have ran, but did not due to holiday.

const (
	TriggerResultStateUnknown TriggerResultState = "UNKNOWN" // Event did not have a result; should never be in this state.
	TriggerResultStateSuccess TriggerResultState = "SUCCESS" // Trigger evaluation was successful.
	TriggerResultStateFailure TriggerResultState = "FAILURE" // Trigger evaluation was not successful.
	TriggerResultStateSkipped TriggerResultState = "SKIPPED" // Trigger evaluation was skipped
)

Jump to

Keyboard shortcuts

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