Documentation ¶
Index ¶
- Constants
- func MarshalChangeGroupsUpdateToken(t *ChangeGroupsUpdateToken) (string, error)
- type BaseStep
- type ChangeGroup
- type ChangeGroupType
- type ChangeGroupsUpdateToken
- type ChangeGroupsValues
- type Container
- type DockerRegistryAuth
- type DockerRegistryAuthType
- type Executor
- type ExecutorTask
- type ExecutorTaskPhase
- type ExecutorTaskSpecData
- type ExecutorTaskStepStatus
- type RestoreCacheStep
- type RestoreWorkspaceStep
- type Run
- type RunBundle
- type RunConfig
- type RunConfigTask
- type RunConfigTaskDepend
- type RunConfigTaskDependCondition
- type RunCounter
- type RunEvent
- type RunEventData
- type RunEventDataRunTask
- type RunEventDataRunTaskDepend
- type RunEventDataRunTaskStep
- type RunEventType
- type RunPhase
- type RunResult
- type RunStep
- type RunTask
- type RunTaskFetchPhase
- type RunTaskStatus
- type RunTaskStep
- type Runtime
- type RuntimeType
- type SaveCacheStep
- type SaveContent
- type SaveToWorkspaceStep
- type SortDirection
- type Step
- type Steps
- type Volume
- type VolumeTmpFS
- type WorkspaceOperation
Constants ¶
View Source
const (
RunGenericSetupErrorName = "Setup Error"
)
Variables ¶
This section is empty.
Functions ¶
func MarshalChangeGroupsUpdateToken ¶
func MarshalChangeGroupsUpdateToken(t *ChangeGroupsUpdateToken) (string, error)
Types ¶
type ChangeGroup ¶ added in v0.8.0
type ChangeGroup struct { sqlg.ObjectMeta Name string `json:"name"` Value string `json:"value"` }
func NewChangeGroup ¶ added in v0.8.0
func NewChangeGroup(tx *sql.Tx) *ChangeGroup
type ChangeGroupType ¶ added in v0.8.0
type ChangeGroupType string
const ( ChangeGroupTypeRun ChangeGroupType = "run" ChangeGroupTypeRunEvent ChangeGroupType = "runevent" )
type ChangeGroupsUpdateToken ¶
type ChangeGroupsUpdateToken struct {
ChangeGroupsValues ChangeGroupsValues `json:"change_groups_values"`
}
func UnmarshalChangeGroupsUpdateToken ¶
func UnmarshalChangeGroupsUpdateToken(s string) (*ChangeGroupsUpdateToken, error)
type ChangeGroupsValues ¶ added in v0.8.0
type DockerRegistryAuth ¶
type DockerRegistryAuth struct { Type DockerRegistryAuthType `json:"type"` // basic auth Username string `json:"username"` Password string `json:"password"` // encoded auth string Auth string `json:"auth"` }
type DockerRegistryAuthType ¶
type DockerRegistryAuthType string
const ( DockerRegistryAuthTypeBasic DockerRegistryAuthType = "basic" DockerRegistryAuthTypeEncodedAuth DockerRegistryAuthType = "encodedauth" )
type Executor ¶
type Executor struct { sqlg.ObjectMeta // ExecutorID is the Executor unique id ExecutorID string `json:"executor_id,omitempty"` ListenURL string `json:"listenURL,omitempty"` Archs []stypes.Arch `json:"archs,omitempty"` Labels map[string]string `json:"labels,omitempty"` AllowPrivilegedContainers bool `json:"allow_privileged_containers,omitempty"` ActiveTasksLimit int `json:"active_tasks_limit,omitempty"` ActiveTasks int `json:"active_tasks,omitempty"` // Dynamic represents an executor that can be automatically removed since it's // part of a group of executors managing the same resources (i.e. a k8s // namespace managed by multiple executors that will automatically clean pods // owned of an old executor) Dynamic bool `json:"dynamic,omitempty"` // ExecutorGroup is the executor group which this executor belongs ExecutorGroup string `json:"executor_group,omitempty"` // SiblingExecutors are all the executors in the ExecutorGroup SiblingsExecutors []string `json:"siblings_executors,omitempty"` }
func NewExecutor ¶ added in v0.8.0
type ExecutorTask ¶
type ExecutorTask struct { sqlg.ObjectMeta ExecutorID string `json:"executor_id,omitempty"` RunID string `json:"run_id,omitempty"` RunTaskID string `json:"run_task_id,omitempty"` // Stop is used to signal from the scheduler when the task must be stopped Stop bool `json:"stop,omitempty"` Phase ExecutorTaskPhase `json:"phase,omitempty"` Timedout bool `json:"timedout,omitempty"` FailError string `json:"fail_error,omitempty"` SetupStep ExecutorTaskStepStatus `json:"setup_step,omitempty"` Steps []*ExecutorTaskStepStatus `json:"steps,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` }
func NewExecutorTask ¶ added in v0.8.0
func NewExecutorTask(tx *sql.Tx) *ExecutorTask
func (*ExecutorTask) DeepCopy ¶ added in v0.3.0
func (et *ExecutorTask) DeepCopy() *ExecutorTask
type ExecutorTaskPhase ¶
type ExecutorTaskPhase string
const ( ExecutorTaskPhaseNotStarted ExecutorTaskPhase = "notstarted" ExecutorTaskPhaseCancelled ExecutorTaskPhase = "cancelled" ExecutorTaskPhaseRunning ExecutorTaskPhase = "running" ExecutorTaskPhaseStopped ExecutorTaskPhase = "stopped" ExecutorTaskPhaseSuccess ExecutorTaskPhase = "success" ExecutorTaskPhaseFailed ExecutorTaskPhase = "failed" )
func (ExecutorTaskPhase) IsFinished ¶
func (s ExecutorTaskPhase) IsFinished() bool
type ExecutorTaskSpecData ¶ added in v0.3.0
type ExecutorTaskSpecData struct { TaskName string `json:"task_name,omitempty"` Arch stypes.Arch `json:"arch,omitempty"` Containers []*Container `json:"containers,omitempty"` Environment map[string]string `json:"environment,omitempty"` WorkingDir string `json:"working_dir,omitempty"` Shell string `json:"shell,omitempty"` User string `json:"user,omitempty"` Privileged bool `json:"privileged"` WorkspaceOperations []WorkspaceOperation `json:"workspace_operations,omitempty"` DockerRegistriesAuth map[string]DockerRegistryAuth `json:"docker_registries_auth"` // Cache prefix to use when asking for a cache key. To isolate caches between // groups (projects) CachePrefix string `json:"cache_prefix,omitempty"` Steps Steps `json:"steps,omitempty"` TaskTimeoutInterval time.Duration `json:"task_timeout_interval"` }
ExecutorTaskSpecData defines the task data required to execute the tasks. These values are not saved in the db to avoid using too much space but are generated everytime they are sent to the executor
type ExecutorTaskStepStatus ¶
type RestoreCacheStep ¶
type RestoreWorkspaceStep ¶
type Run ¶
type Run struct { sqlg.ObjectMeta // Sequence is an unique per runservice increasing sequence number Sequence uint64 `json:"sequence"` Name string `json:"name,omitempty"` RunConfigID string `json:"run_config_id,omitempty"` Counter uint64 `json:"counter,omitempty"` // Group is the run group of the run. Every run is assigned to a specific group // The format is /$grouptypes/groupname(/$grouptype/groupname ...) // i.e. /project/$projectid/branch/$branchname // /project/$projectid/pr/$prid Group string `json:"group,omitempty"` // Annotations contain custom run annotations Annotations map[string]string `json:"annotations,omitempty"` // Phase represent the current run status. A run could be running but already // marked as failed due to some tasks failed. The run will be marked as finished // only then all the executor tasks are known to be really ended. This permits // "at most once" running runs per branch/project (useful for example to avoid // multiple concurrent "deploy" tasks that may cause issues) Phase RunPhase `json:"phase,omitempty"` // Result of a Run. Result RunResult `json:"result,omitempty"` // Stop is used to signal from the scheduler when the run must be stopped Stop bool `json:"stop,omitempty"` Tasks map[string]*RunTask `json:"tasks,omitempty"` EnqueueTime *time.Time `json:"enqueue_time,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` Archived bool `json:"archived,omitempty"` }
Run is the run status of a RUN. It should containt the status of the current run. The run definition must live in the RunConfig and not here.
func (*Run) CanRestartFromFailedTasks ¶
CanRestartFromFailedTasks reports if the run can be restarted from failed tasks
func (*Run) CanRestartFromScratch ¶
CanRestartFromScratch reports if the run can be restarted from scratch
func (*Run) ChangePhase ¶
func (*Run) TasksWaitingApproval ¶
type RunConfig ¶
type RunConfig struct { sqlg.ObjectMeta Name string `json:"name,omitempty"` // Group is the run group of the run. Every run is assigned to a specific group // The format is /$grouptypes/groupname(/$grouptype/groupname ...) // i.e. /project/$projectid/branch/$branchname // /project/$projectid/pr/$prid Group string `json:"group,omitempty"` // A list of setup errors when the run is in phase setuperror SetupErrors []string `json:"setup_errors,omitempty"` // Annotations contain custom run annotations // Note: Annotations are currently both saved in a Run and in RunConfig to // easily return them without loading RunConfig from the lts Annotations map[string]string `json:"annotations,omitempty"` // StaticEnvironment contains all environment variables that won't change when // generating a new run (like COMMIT_SHA, BRANCH, REPOSITORY_URL etc...) StaticEnvironment map[string]string `json:"static_environment,omitempty"` // Environment contains all environment variables that are different between // runs recreations (like secrets that may change or user provided enviroment // specific to this run) Environment map[string]string `json:"environment,omitempty"` Tasks map[string]*RunConfigTask `json:"tasks,omitempty"` // CacheGroup is the cache group where the run caches belongs CacheGroup string `json:"cache_group,omitempty"` }
RunConfig is the run configuration. It contains everything that isn't a state (that is contained in a Run) and that may use a lot of space. There is a RunConfig for every Run.
func NewRunConfig ¶ added in v0.8.0
type RunConfigTask ¶
type RunConfigTask struct { Level int `json:"level,omitempty"` ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Depends map[string]*RunConfigTaskDepend `json:"depends"` Runtime *Runtime `json:"runtime,omitempty"` Environment map[string]string `json:"environment,omitempty"` WorkingDir string `json:"working_dir,omitempty"` Shell string `json:"shell,omitempty"` User string `json:"user,omitempty"` Steps Steps `json:"steps,omitempty"` IgnoreFailure bool `json:"ignore_failure,omitempty"` NeedsApproval bool `json:"needs_approval,omitempty"` Skip bool `json:"skip,omitempty"` DockerRegistriesAuth map[string]DockerRegistryAuth `json:"docker_registries_auth"` TaskTimeoutInterval time.Duration `json:"task_timeout_interval"` }
func (*RunConfigTask) DeepCopy ¶
func (rct *RunConfigTask) DeepCopy() *RunConfigTask
type RunConfigTaskDepend ¶
type RunConfigTaskDepend struct { TaskID string `json:"task_id,omitempty"` Conditions []RunConfigTaskDependCondition `json:"conditions,omitempty"` }
type RunConfigTaskDependCondition ¶
type RunConfigTaskDependCondition string
const ( RunConfigTaskDependConditionOnSuccess RunConfigTaskDependCondition = "on_success" RunConfigTaskDependConditionOnFailure RunConfigTaskDependCondition = "on_failure" RunConfigTaskDependConditionOnSkipped RunConfigTaskDependCondition = "on_skipped" )
type RunCounter ¶
type RunCounter struct { sqlg.ObjectMeta GroupID string Value uint64 }
func NewRunCounter ¶ added in v0.8.0
func NewRunCounter(tx *sql.Tx, groupID string) *RunCounter
type RunEvent ¶
type RunEvent struct { sqlg.ObjectMeta Sequence uint64 RunEventType RunEventType RunID string Phase RunPhase Result RunResult Data any DataVersion uint64 }
func NewRunEvent ¶ added in v0.8.0
func (*RunEvent) UnmarshalJSON ¶ added in v0.9.0
type RunEventData ¶ added in v0.9.0
type RunEventData struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Counter uint64 `json:"counter,omitempty"` Phase string `json:"phase,omitempty"` Result string `json:"result,omitempty"` SetupErrors []string `json:"setup_errors,omitempty"` Tasks map[string]*RunEventDataRunTask `json:"tasks,omitempty"` EnqueueTime *time.Time `json:"enqueue_time,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` Annotations map[string]string `json:"annotations,omitempty"` }
type RunEventDataRunTask ¶ added in v0.9.0
type RunEventDataRunTask struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Level int `json:"level,omitempty"` Skip bool `json:"skip,omitempty"` Depends map[string]*RunEventDataRunTaskDepend `json:"depends,omitempty"` Status string `json:"status,omitempty"` Timedout bool `json:"timedout,omitempty"` WaitingApproval bool `json:"waiting_approval,omitempty"` Approved bool `json:"approved,omitempty"` SetupStep RunEventDataRunTaskStep `json:"setup_step,omitempty"` Steps []*RunEventDataRunTaskStep `json:"steps,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` }
type RunEventDataRunTaskDepend ¶ added in v0.9.0
type RunEventDataRunTaskStep ¶ added in v0.9.0
type RunEventType ¶ added in v0.9.0
type RunEventType string
const ( RunPhaseChanged RunEventType = "run_phase_changed" RunEventDataVersion = 1 )
type RunTask ¶
type RunTask struct { ID string `json:"id,omitempty"` // Status is the current known RunTask status reported by the executor. So // sometime it won't be the real status since there may be some already running // executor tasks not yet reported back. // So don't rely to know if a runtask is really not running but also check that // there're no executor tasks scheduled Status RunTaskStatus `json:"status,omitempty"` // Timedout represent if the task has timed out Timedout bool `json:"timedout,omitempty"` // Annotations contain custom task annotations // these are opaque to the runservice and used for multiple pourposes. For // example to stores task approval metadata. Annotations map[string]string `json:"annotations,omitempty"` Skip bool `json:"skip,omitempty"` WaitingApproval bool `json:"waiting_approval,omitempty"` Approved bool `json:"approved,omitempty"` SetupStep RunTaskStep `json:"setup_step,omitempty"` Steps []*RunTaskStep `json:"steps,omitempty"` // steps numbers of workspace archives, WorkspaceArchives []int `json:"workspace_archives,omitempty"` WorkspaceArchivesPhase []RunTaskFetchPhase `json:"workspace_archives_phase,omitempty"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` TaskTimeoutInterval *time.Duration `json:"task_timeout_interval"` }
func (*RunTask) ArchivesFetchFinished ¶
func (*RunTask) LogsFetchFinished ¶
type RunTaskFetchPhase ¶
type RunTaskFetchPhase string
const ( RunTaskFetchPhaseNotStarted RunTaskFetchPhase = "notstarted" RunTaskFetchPhaseFinished RunTaskFetchPhase = "finished" )
type RunTaskStatus ¶
type RunTaskStatus string
const ( RunTaskStatusNotStarted RunTaskStatus = "notstarted" RunTaskStatusSkipped RunTaskStatus = "skipped" RunTaskStatusCancelled RunTaskStatus = "cancelled" RunTaskStatusRunning RunTaskStatus = "running" RunTaskStatusStopped RunTaskStatus = "stopped" RunTaskStatusSuccess RunTaskStatus = "success" RunTaskStatusFailed RunTaskStatus = "failed" )
func (RunTaskStatus) IsFinished ¶
func (s RunTaskStatus) IsFinished() bool
type RunTaskStep ¶
type RunTaskStep struct { Phase ExecutorTaskPhase `json:"phase,omitempty"` // one logphase for every task step LogPhase RunTaskFetchPhase `json:"log_phase,omitempty"` ExitStatus *int `json:"exit_status"` StartTime *time.Time `json:"start_time,omitempty"` EndTime *time.Time `json:"end_time,omitempty"` }
type Runtime ¶
type Runtime struct { Type RuntimeType `json:"type,omitempty"` Arch stypes.Arch `json:"arch,omitempty"` Containers []*Container `json:"containers,omitempty"` }
type SaveCacheStep ¶
type SaveCacheStep struct { BaseStep Key string `json:"key,omitempty"` Contents []SaveContent `json:"contents,omitempty"` }
type SaveContent ¶
type SaveToWorkspaceStep ¶
type SaveToWorkspaceStep struct { BaseStep Contents []SaveContent `json:"contents,omitempty"` }
type SortDirection ¶ added in v0.9.0
type SortDirection string
const ( SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
type Volume ¶ added in v0.3.0
type Volume struct { Path string `json:"path"` TmpFS *VolumeTmpFS `json:"tmpfs"` }
type VolumeTmpFS ¶ added in v0.3.0
type VolumeTmpFS struct {
Size int64 `json:"size"`
}
type WorkspaceOperation ¶
Click to show internal directories.
Click to hide internal directories.