Documentation ¶
Overview ¶
Package models contains the core objects(otherwise called the domain models) needed by Gofer internally.
This package exists to provide easy to use in-memory objects for concepts Gofer has to work with. For example, the concept of a Pipeline might make sense to the database as 3-4 different models/structs containing different extensions that a pipeline might be made out of, but to the API a pipeline might be easier represented as one single entity containing all those different parts. This might make it easier to pass around and work with in general.
The next question that might be asked is why separate these models at all? Why not have one struct that we ride all the way to the top? The answer to that is the separation of domain models from DB models and in general any other model that has a contract with something else is usually a good thing. This loose coupling enables a lot of good practices as the code base gets more complex overtime. Two examples:
- We may want to use simplier names for our database naming in order to save space, but more descriptive names for our domain layer.
- We may want to change something in our database layer and might not want to go through the trouble of having to also change the API contract with outside users. Changes on that level can be extremely expensive in terms of engineering time/complexcity etc.
You can read more about this here: https://threedots.tech/post/common-anti-patterns-in-go-web-applications/
Because this package contains the domain models, it effectively acts as the middle package between the internal storage layer and the external protobuf layer. The general flow goes like this:
Protobuf from API calls <-> models internally <-> backend storage.
Something to keep in mind when making changes to this package:
This package can be somewhat brittle as Go does not alert on missing struct fields and converting things to proto/storage is done manually. The combination of these two things means that unfortunately these models may connect to other models in ways that might not be obvious and changes to them might break things in ways that are hard to set up testing for. Testing would need to heavily use reflection to prevent breakages and for now I don't have the time. The real solution would probably be something involving code generation, but I don't have a good answer for that either.
Index ¶
- func Ptr[T any](v T) *T
- type Deployment
- type DeploymentState
- type DeploymentStatus
- type DeploymentStatusReason
- type DeploymentStatusReasonKind
- type Event
- type Extension
- type ExtensionRegistration
- type ExtensionState
- type ExtensionStatus
- type ExtensionSubscriptionStatus
- type ExtensionSubscriptionStatusReason
- type ExtensionSubscriptionStatusReasonKind
- type Initiator
- type InitiatorType
- type Namespace
- type ObjectStoreKey
- type Pipeline
- type PipelineConfig
- type PipelineConfigState
- type PipelineExtensionSubscription
- type PipelineMetadata
- type PipelineState
- type RegistryAuth
- type RequiredParentStatus
- type Run
- type RunState
- type RunStatus
- type RunStatusReason
- type RunStatusReasonKind
- type SecretStoreKey
- type Task
- type TaskRun
- type TaskRunState
- type TaskRunStatus
- type TaskRunStatusReason
- type TaskRunStatusReasonKind
- type Token
- type TokenKind
- type Variable
- type VariableSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deployment ¶ added in v0.5.0
type Deployment struct { Namespace string `json:"namespace"` // Unique ID of namespace. Pipeline string `json:"pipeline"` // The unique ID of the related pipeline. ID int64 `json:"id"` // Unique identifier for deployment StartVersion int64 `json:"start_version"` // What version of the pipeline is being deprecated. EndVersion int64 `json:"end_version"` // What version of the pipeline are we moving to. Started int64 `json:"started"` // Time of run start in epoch milli. Ended int64 `json:"ended"` // Time of run finish in epoch milli. State DeploymentState `json:"state"` // The current state of the run. Status DeploymentStatus `json:"status"` // The current status of the run. StatusReason *DeploymentStatusReason `json:"status_reason"` // Contains more information about a run's current status. Logs []Event `json:"logs"` // An ordered event stream of what happened during the deployment. }
A deployment represents a transition between pipeline versions.
func NewDeployment ¶ added in v0.5.0
func NewDeployment(namespace, pipeline string, id, startVersion, endVersion int64) *Deployment
func (*Deployment) FromStorage ¶ added in v0.5.0
func (d *Deployment) FromStorage(storage *storage.PipelineDeployment)
func (*Deployment) ToProto ¶ added in v0.5.0
func (d *Deployment) ToProto() *proto.Deployment
func (*Deployment) ToStorage ¶ added in v0.5.0
func (d *Deployment) ToStorage() *storage.PipelineDeployment
type DeploymentState ¶ added in v0.5.0
type DeploymentState string
const ( DeploymentStateUnknown DeploymentState = "UNKNOWN" // The state of the run is unknown. DeploymentStateRunning DeploymentState = "RUNNING" DeploymentStateComplete DeploymentState = "COMPLETE" )
type DeploymentStatus ¶ added in v0.5.0
type DeploymentStatus string
const ( // Could not determine current state of the status. Should only be in this state if // the deployment has not yet completed. DeploymentStatusUnknown DeploymentStatus = "UNKNOWN" DeploymentStatusFailed DeploymentStatus = "FAILED" DeploymentStatusSuccessful DeploymentStatus = "SUCCESSFUL" )
type DeploymentStatusReason ¶ added in v0.5.0
type DeploymentStatusReason struct { // The specific type of deployment failure. Good for documentation about what it might be. Reason DeploymentStatusReasonKind `json:"kind"` Description string `json:"description"` // The description of why the run might have failed. }
func (*DeploymentStatusReason) ToJSON ¶ added in v0.5.0
func (r *DeploymentStatusReason) ToJSON() string
func (*DeploymentStatusReason) ToProto ¶ added in v0.5.0
func (r *DeploymentStatusReason) ToProto() *proto.DeploymentStatusReason
type DeploymentStatusReasonKind ¶ added in v0.5.0
type DeploymentStatusReasonKind string
const ( // Gofer has no idea how the deployment got into this state. DeploymentStatusReasonUnknown DeploymentStatusReasonKind = "UNKNOWN" )
type Event ¶ added in v0.1.0
func (*Event) FromStorage ¶ added in v0.5.0
type Extension ¶ added in v0.5.0
type Extension struct { Registration ExtensionRegistration `json:"registration"` // URL is the network address used to communicate with the extension by the main process. URL string `json:"url"` Started int64 `json:"started"` // The start time of the extension in epoch milliseconds. State ExtensionState `json:"state"` Documentation string `json:"documentation"` // The documentation for this specific extension. // Key is a extension'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 extensions directly. Key *string `json:"-"` }
type ExtensionRegistration ¶ added in v0.5.0
type ExtensionRegistration struct { Name string `json:"name"` Image string `json:"image"` RegistryAuth *RegistryAuth `json:"registry_auth"` Variables []Variable `json:"variables"` Created int64 `json:"created"` Status ExtensionStatus `json:"status"` KeyID int64 `json:"key_id"` }
When installing a new extension, we allow the extension installer to pass a bunch of settings that allow us to go get that extension on future startups.
func (*ExtensionRegistration) FromInstallExtensionRequest ¶ added in v0.5.0
func (c *ExtensionRegistration) FromInstallExtensionRequest(proto *proto.InstallExtensionRequest)
func (*ExtensionRegistration) FromStorage ¶ added in v0.5.0
func (c *ExtensionRegistration) FromStorage(tr *storage.GlobalExtensionRegistration)
func (*ExtensionRegistration) ToStorage ¶ added in v0.5.0
func (c *ExtensionRegistration) ToStorage() *storage.GlobalExtensionRegistration
type ExtensionState ¶ added in v0.5.0
type ExtensionState string
const ( ExtensionStateUnknown ExtensionState = "UNKNOWN" // Unknown state, can be in this state because of an error. ExtensionStateProcessing ExtensionState = "PROCESSING" // Pre-scheduling validation and prep. ExtensionStateRunning ExtensionState = "RUNNING" // Currently running as reported by scheduler. ExtensionStateExited ExtensionState = "EXITED" // Extension has exited; usually because of an error. )
type ExtensionStatus ¶ added in v0.5.0
type ExtensionStatus string
const ( ExtensionStatusUnknown ExtensionStatus = "UNKNOWN" // Cannot determine status of Extension, should never be in this status. ExtensionStatusEnabled ExtensionStatus = "ENABLED" // Installed and able to be used by pipelines. /// Not available to be used by pipelines, either through lack of installation or /// being disabled by an admin. ExtensionStatusDisabled ExtensionStatus = "DISABLED" )
type ExtensionSubscriptionStatus ¶ added in v0.5.0
type ExtensionSubscriptionStatus string
const ( ExtensionSubscriptionStatusUnknown ExtensionSubscriptionStatus = "UNKNOWN" // Subscription is successfully connected and active. ExtensionSubscriptionStatusActive ExtensionSubscriptionStatus = "ACTIVE" // Subscription is not connected and inactive due to error. ExtensionSubscriptionStatusError ExtensionSubscriptionStatus = "ERROR" // Subscription is connected, but inactive due to user or operator request. ExtensionSubscriptionStatusDisabled ExtensionSubscriptionStatus = "DISABLED" )
type ExtensionSubscriptionStatusReason ¶ added in v0.5.0
type ExtensionSubscriptionStatusReason struct { // The specific type of subscription failure. Good for documentation about what it might be. Reason ExtensionSubscriptionStatusReasonKind `json:"kind"` Description string `json:"description"` // The description of why the run might have failed. }
func (*ExtensionSubscriptionStatusReason) ToJSON ¶ added in v0.5.0
func (r *ExtensionSubscriptionStatusReason) ToJSON() string
func (*ExtensionSubscriptionStatusReason) ToProto ¶ added in v0.5.0
func (r *ExtensionSubscriptionStatusReason) ToProto() *proto.PipelineExtensionSubscriptionStatusReason
type ExtensionSubscriptionStatusReasonKind ¶ added in v0.5.0
type ExtensionSubscriptionStatusReasonKind string
const ( ExtensionSubscriptionStatusReasonUnknown ExtensionSubscriptionStatusReasonKind = "UNKNOWN" ExtensionSubscriptionStatusReasonExtensionNotFound ExtensionSubscriptionStatusReasonKind = "EXTENSION_NOT_FOUND" ExtensionSubscriptionStatusReasonExtensionSubscriptionFailed ExtensionSubscriptionStatusReasonKind = "EXTENSION_SUBSCRIPTION_FAILED" )
type Initiator ¶ added in v0.5.0
type Initiator struct { Type InitiatorType `json:"type"` Name string `json:"name"` Reason string `json:"reason"` }
Information about which extension was responsible for the run's execution.
type InitiatorType ¶ added in v0.5.0
type InitiatorType string
const ( // Gofer has no idea who was the initiator. InitiatorTypeUnknown InitiatorType = "UNKNOWN" InitiatorTypeBot InitiatorType = "BOT" InitiatorTypeHuman InitiatorType = "HUMAN" InitiatorTypeExtension InitiatorType = "EXTENSION" )
type Namespace ¶
type Namespace struct { ID string `json:"id"` // Unique identifier; user defined. Name string `json:"name"` // Humanized name; great for reading from UIs. Description string `json:"description"` // Short description on what namespace is used for. Created int64 `json:"created"` // The creation time in epoch milli. Modified int64 `json:"modified"` // The modified time in epoch milli; }
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 (*Namespace) FromStorage ¶ added in v0.5.0
type ObjectStoreKey ¶ added in v0.5.0
func NewObjectStoreKey ¶ added in v0.5.0
func NewObjectStoreKey(key string) *ObjectStoreKey
func (*ObjectStoreKey) ToProto ¶ added in v0.5.0
func (s *ObjectStoreKey) ToProto() *proto.ObjectStoreKey
type Pipeline ¶
type Pipeline struct { Metadata PipelineMetadata Config PipelineConfig }
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 namespaces and containing runs.
type PipelineConfig ¶
type PipelineConfig struct { Namespace string `json:"namespace"` Pipeline string `json:"pipeline"` Version int64 `json:"version"` Parallelism int64 `json:"parallelism"` Name string `json:"name"` // Name refers to a human readable pipeline name. Description string `json:"description"` // Description of pipeline's purpose and other details. // Map for quickly finding user created pipeline tasks; assists with DAG generation. Tasks map[string]Task `json:"tasks"` // 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 PipelineConfigState `json:"state"` Registered int64 `json:"registered"` // If the pipeline's state is "deprecated" we note the time it was so we know which is the oldest defunct version. Deprecated int64 `json:"deprecated"` }
A representation of the user's configuration settings for a particular pipeline.
func NewPipelineConfig ¶ added in v0.5.0
func NewPipelineConfig(namespace, pipeline string, version int64, pb *proto.UserPipelineConfig) *PipelineConfig
func (*PipelineConfig) FromStorage ¶ added in v0.5.0
func (pc *PipelineConfig) FromStorage(spc *storage.PipelineConfig, spct *[]storage.PipelineTask, )
func (*PipelineConfig) ToProto ¶ added in v0.5.0
func (pc *PipelineConfig) ToProto() *proto.PipelineConfig
func (*PipelineConfig) ToStorage ¶ added in v0.5.0
func (pc *PipelineConfig) ToStorage() (*storage.PipelineConfig, []*storage.PipelineTask)
type PipelineConfigState ¶ added in v0.5.0
type PipelineConfigState string
const ( PipelineConfigStateUnknown PipelineConfigState = "UNKNOWN" PipelineConfigStateUnreleased PipelineConfigState = "UNRELEASED" // Has never been deployed. PipelineConfigStateLive PipelineConfigState = "LIVE" // Currently deployed. PipelineConfigStateDeprecated PipelineConfigState = "DEPRECATED" // Has previously been deployed and is now defunct. )
type PipelineExtensionSubscription ¶ added in v0.5.0
type PipelineExtensionSubscription struct { Namespace string Pipeline string Name string Label string Settings map[string]string Status ExtensionSubscriptionStatus StatusReason ExtensionSubscriptionStatusReason }
func FromCreatePipelineExtensionSubscriptionRequest ¶ added in v0.5.0
func FromCreatePipelineExtensionSubscriptionRequest(request *proto.CreatePipelineExtensionSubscriptionRequest) *PipelineExtensionSubscription
func (*PipelineExtensionSubscription) FromStorage ¶ added in v0.5.0
func (ts *PipelineExtensionSubscription) FromStorage(storage *storage.PipelineExtensionSubscription)
func (*PipelineExtensionSubscription) ToProto ¶ added in v0.5.0
func (ts *PipelineExtensionSubscription) ToProto() *proto.PipelineExtensionSubscription
func (*PipelineExtensionSubscription) ToStorage ¶ added in v0.5.0
func (ts *PipelineExtensionSubscription) ToStorage() *storage.PipelineExtensionSubscription
type PipelineMetadata ¶ added in v0.5.0
type PipelineMetadata struct { Namespace string `json:"namespace"` // The namespace this pipeline belongs to. ID string `json:"id"` // Unique identifier; user defined. // Controls how many runs can be active at any single time. 0 indicates unbounded with respect to bounds // enforced by Gofer. Created int64 `json:"created"` // Time pipeline was created in epoch milliseconds. Modified int64 `json:"modified"` // Time pipeline was updated to a new version in epoch milliseconds. // 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"` }
Details about the pipeline itself, not including the configuration that the user can change. All these values are changed by the system or never changed at all. This sits in contrast to the config which the user can change freely.
func NewPipelineMetadata ¶ added in v0.5.0
func NewPipelineMetadata(namespace, id string) *PipelineMetadata
func (*PipelineMetadata) FromStorage ¶ added in v0.5.0
func (p *PipelineMetadata) FromStorage(sp *storage.PipelineMetadata)
func (*PipelineMetadata) ToProto ¶ added in v0.5.0
func (p *PipelineMetadata) ToProto() *proto.PipelineMetadata
func (*PipelineMetadata) ToStorage ¶ added in v0.5.0
func (p *PipelineMetadata) ToStorage() *storage.PipelineMetadata
type PipelineState ¶
type PipelineState string
const ( PipelineStateUnknown PipelineState = "UNKNOWN" PipelineStateActive PipelineState = "ACTIVE" PipelineStateDisabled PipelineState = "DISABLED" )
type RegistryAuth ¶ added in v0.0.3
func (*RegistryAuth) FromProto ¶ added in v0.5.0
func (t *RegistryAuth) FromProto(pb *proto.RegistryAuth)
func (*RegistryAuth) FromStorage ¶ added in v0.5.0
func (t *RegistryAuth) FromStorage(jsonStr string)
func (*RegistryAuth) ToProto ¶ added in v0.0.3
func (t *RegistryAuth) ToProto() *proto.RegistryAuth
func (*RegistryAuth) ToStorage ¶ added in v0.5.0
func (t *RegistryAuth) ToStorage() string
type RequiredParentStatus ¶ added in v0.5.0
type RequiredParentStatus string
const ( RequiredParentStatusUnknown RequiredParentStatus = "UNKNOWN" RequiredParentStatusAny RequiredParentStatus = "ANY" RequiredParentStatusSuccess RequiredParentStatus = "SUCCESS" RequiredParentStatusFailure RequiredParentStatus = "FAILURE" )
func (*RequiredParentStatus) FromStr ¶ added in v0.5.0
func (s *RequiredParentStatus) FromStr(input string) RequiredParentStatus
type Run ¶
type Run struct { Namespace string `json:"namespace"` // Unique ID of namespace. Pipeline string `json:"pipeline"` // The unique ID of the related pipeline. Version int64 `json:"version"` // Which version of the pipeline did this run occur. ID int64 `json:"id"` // UniqueID of a run. Auto-incrementing and cannot be zero. Started int64 `json:"started"` // Time of run start in epoch milli. Ended int64 `json:"ended"` // Time of run finish in epoch milli. State RunState `json:"state"` // The current state of the run. Status RunStatus `json:"status"` // The current status of the run. StatusReason *RunStatusReason `json:"status_reason"` // Contains more information about a run's current status. Initiator Initiator `json:"initiator"` // Information who started the run and why. Variables []Variable `json:"variables"` // Environment variables to be injected into each child task run. These are usually injected by the extension. StoreObjectsExpired bool `json:"store_objects_expired"` // Tracks whether objects for this run have expired already. }
A run is one or more tasks being executed on behalf of some extension. Run is a third level unit containing tasks and being contained in a pipeline.
func (*Run) FromStorage ¶ added in v0.5.0
func (r *Run) FromStorage(storage *storage.PipelineRun)
func (*Run) ToStorage ¶ added in v0.5.0
func (r *Run) ToStorage() *storage.PipelineRun
type RunState ¶
type RunState string
const ( RunStateUnknown RunState = "UNKNOWN" // The state of the run is unknown. // Before the tasks in a run is sent to a scheduler it must complete various steps like // validation checking. This state represents that step where the run and task_runs are // pre-checked. RunStatePending RunState = "PENDING" RunStateRunning RunState = "RUNNING" // Currently running. RunStateComplete RunState = "COMPLETE" // All tasks have been resolved and the run is no longer being executed. )
type RunStatus ¶ added in v0.5.0
type RunStatus string
const ( // Could not determine current state of the status. Should only be in this state if // the run has not yet completed. RunStatusUnknown RunStatus = "UNKNOWN" RunStatusFailed RunStatus = "FAILED" // One or more tasks in run have failed. RunStatusSuccessful RunStatus = "SUCCESSFUL" // All tasks in run have completed with a non-failure state. RunStatusCancelled RunStatus = "CANCELLED" // One or more tasks in a run have been cancelled. )
type RunStatusReason ¶ added in v0.5.0
type RunStatusReason struct { Reason RunStatusReasonKind `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. }
func (*RunStatusReason) ToJSON ¶ added in v0.5.0
func (r *RunStatusReason) ToJSON() string
func (*RunStatusReason) ToProto ¶ added in v0.5.0
func (r *RunStatusReason) ToProto() *proto.RunStatusReason
type RunStatusReasonKind ¶ added in v0.5.0
type RunStatusReasonKind string
const ( // Gofer has no idea who the run got into this state. RunStatusReasonKindUnknown RunStatusReasonKind = "UNKNOWN" // While executing the run one or more tasks exited with an abnormal exit code. RunStatusReasonKindAbnormalExit RunStatusReasonKind = "ABNORMAL_EXIT" // While executing the run one or more tasks could not be scheduled. RunStatusReasonKindSchedulerError RunStatusReasonKind = "SCHEDULER_ERROR" // The run could not be executed as requested due to user defined attributes given. RunStatusReasonKindFailedPrecondition RunStatusReasonKind = "FAILED_PRECONDITION" // One or more tasks could not be completed due to a user cancelling the run. RunStatusReasonKindUserCancelled RunStatusReasonKind = "USER_CANCELLED" // One or more tasks could not be completed due to the system or admin cancelling the run. RunStatusReasonKindAdminCancelled RunStatusReasonKind = "ADMIN_CANCELLED" )
type SecretStoreKey ¶ added in v0.5.0
type SecretStoreKey struct { Key string `json:"key"` Namespaces []string `json:"namespaces"` Created int64 `json:"created"` }
func NewSecretStoreKey ¶ added in v0.5.0
func NewSecretStoreKey(key string, namespaces []string) *SecretStoreKey
func (*SecretStoreKey) FromGlobalSecretKeyStorage ¶ added in v0.5.0
func (s *SecretStoreKey) FromGlobalSecretKeyStorage(sn *storage.SecretStoreGlobalKey)
func (*SecretStoreKey) IsAllowedNamespace ¶ added in v0.5.0
func (s *SecretStoreKey) IsAllowedNamespace(namespace string) bool
Checks a global secret key's namespace list to confirm it actually does match a given namespace. It loops through the namespaces list and tries to evaluate regexps when it can.
func (*SecretStoreKey) ToGlobalSecretKeyStorage ¶ added in v0.5.0
func (s *SecretStoreKey) ToGlobalSecretKeyStorage() *storage.SecretStoreGlobalKey
func (*SecretStoreKey) ToProto ¶ added in v0.5.0
func (s *SecretStoreKey) ToProto() *proto.SecretStoreKey
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]RequiredParentStatus `json:"depends_on"` Variables []Variable `json:"variables"` Entrypoint *[]string `json:"entrypoint"` Command *[]string `json:"command"` // Allows users to tell gofer to auto-create and inject API Token into task. If this setting is found, Gofer creates // an API key for the run (stored in the user's secret store) and then injects it for this run under the // environment variables "GOFER_API_TOKEN". This key is automatically cleaned up when Gofer attempts to clean up // the Run's objects. InjectAPIToken bool `json:"inject_api_token"` }
func (*Task) FromProtoPipelineTaskConfig ¶ added in v0.5.0
func (r *Task) FromProtoPipelineTaskConfig(t *proto.UserPipelineTaskConfig)
func (*Task) FromStorage ¶ added in v0.5.0
func (r *Task) FromStorage(t *storage.PipelineTask)
type TaskRun ¶
type TaskRun struct { Namespace string `json:"namespace"` // Unique identifier for namespace. Pipeline string `json:"pipeline"` // Unique pipeline ID of task run. Version int64 `json:"version"` // Which version of the pipeline did this task run occur in. Run int64 `json:"run"` // Unique run ID of task run; sequential. ID string `json:"id"` // Unique ID for task run; taken from the taskID. Created int64 `json:"created"` // Time of task run creation in epoch milliseconds. Started int64 `json:"started"` // Time of task run actual start in epoch milliseconds. Ended int64 `json:"ended"` // Time of task run completion in epoch milliseconds. ExitCode *int64 `json:"exit_code"` // The exit code of the task run. 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"` State TaskRunState `json:"state"` Status TaskRunStatus `json:"status"` StatusReason *TaskRunStatusReason `json:"status_reason"` // Extra information about the current status. Variables []Variable `json:"variables"` // The environment variables injected during this particular task run. Task Task `json:"task"` // Task information. }
A task run is a specific execution of a task/container. It represents a 4th level unit in the hierarchy:
namespace -> pipeline -> run -> taskrun
func NewTaskRun ¶
func (*TaskRun) FromStorage ¶ added in v0.5.0
func (r *TaskRun) FromStorage(storage *storage.PipelineTaskRun)
func (*TaskRun) ToStorage ¶ added in v0.5.0
func (r *TaskRun) ToStorage() *storage.PipelineTaskRun
type TaskRunState ¶ added in v0.5.0
type TaskRunState string
const ( TaskRunStateUnknown TaskRunState = "UNKNOWN" // Unknown state, should never be in this state. TaskRunStateProcessing TaskRunState = "PROCESSING" // Pre-scheduling validation and prep. TaskRunStateWaiting TaskRunState = "WAITING" // Waiting to be scheduled. TaskRunStateRunning TaskRunState = "RUNNING" // Currently running as reported by scheduler. TaskRunStateComplete TaskRunState = "COMPLETE" )
type TaskRunStatus ¶ added in v0.5.0
type TaskRunStatus string
const ( TaskRunStatusUnknown TaskRunStatus = "UNKNOWN" TaskRunStatusFailed TaskRunStatus = "FAILED" // Has encountered an issue, either container issue or scheduling issue. TaskRunStatusSuccessful TaskRunStatus = "SUCCESSFUL" // Finished with a proper error code. TaskRunStatusCancelled TaskRunStatus = "CANCELLED" // Cancelled mid run due to user requested cancellation. TaskRunStatusSkipped TaskRunStatus = "SKIPPED" // Not run due to dependencies not being met. )
type TaskRunStatusReason ¶ added in v0.5.0
type TaskRunStatusReason struct { Reason TaskRunStatusReasonKind `json:"reason"` // Specific type; useful for documentation. Description string `json:"description"` // Details about type. }
func (*TaskRunStatusReason) ToJSON ¶ added in v0.5.0
func (t *TaskRunStatusReason) ToJSON() string
func (*TaskRunStatusReason) ToProto ¶ added in v0.5.0
func (t *TaskRunStatusReason) ToProto() *proto.TaskRunStatusReason
type TaskRunStatusReasonKind ¶ added in v0.5.0
type TaskRunStatusReasonKind string
const ( TaskRunStatusReasonKindUnknown TaskRunStatusReasonKind = "UNKNOWN" // Unknown state, should never be in this state. TaskRunStatusReasonKindAbnormalExit TaskRunStatusReasonKind = "ABNORMAL_EXIT" // A non-zero exit code has been received. TaskRunStatusReasonKindSchedulerError TaskRunStatusReasonKind = "SCHEDULER_ERROR" // Encountered an error with the backend scheduler. TaskRunStatusReasonKindFailedPrecondition TaskRunStatusReasonKind = "FAILED_PRECONDITION" // User error in task run parameters. TaskRunStatusReasonKindCancelled TaskRunStatusReasonKind = "CANCELLED" // User invoked cancellation. TaskRunStatusReasonKindOrphaned TaskRunStatusReasonKind = "ORPHANED" // Task run was lost due to extreme internal error. )
type Token ¶
type Token struct { Hash string `json:"hash"` // SHA-256 hash of the secret ID. Created int64 `json:"created"` // Create time in epoch millisecond 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, strings in this list might be a regex. Metadata map[string]string `json:"metadata"` // Extra information about this token in label form. Expires int64 `json:"expiry"` // When the token would expire. Disabled bool `json:"disabled"` // Disabled tokens cannot be used. }
Token is a representation of the API key, belonging to an owner.
func (*Token) FromStorage ¶ added in v0.5.0
type Variable ¶ added in v0.5.0
type Variable struct { Key string `json:"key"` Value string `json:"value"` Source VariableSource `json:"source"` // Where the variable originated from }
A variable is a key value pair that is used either in a run or task level. The variable is inserted as an environment variable to an eventual task run. It can be owned by different parts of the system which control where the potentially sensitive variables might show up.
type VariableSource ¶ added in v0.5.0
type VariableSource string
const ( VariableSourceUnknown VariableSource = "UNKNOWN" VariableSourcePipelineConfig VariableSource = "PIPELINE_CONFIG" VariableSourceSystem VariableSource = "SYSTEM" VariableSourceRunOptions VariableSource = "RUN_OPTIONS" VariableSourceExtension VariableSource = "EXTENSION" )