Documentation
¶
Index ¶
- Constants
- func CanRequestCleanup(ctx context.Context, runnerID int64) (bool, error)
- func CompleteBandwidthCheckRequest(ctx context.Context, id int64, oldMbps, newMbps float64) error
- func CompleteCleanupRequest(ctx context.Context, id int64, success bool, bytesFreed int64, errorMsg string) error
- func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error)
- func CountRunnersWithoutBelongingRepo(ctx context.Context) (int64, error)
- func CountWrongRepoLevelRunners(ctx context.Context) (int64, error)
- func CountWrongRepoLevelVariables(ctx context.Context) (int64, error)
- func CreateRunner(ctx context.Context, t *ActionRunner) error
- func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error
- func DeleteEphemeralRunner(ctx context.Context, id int64) error
- func DeleteRunner(ctx context.Context, id int64) error
- func DeleteScheduleTaskByRepo(ctx context.Context, id int64) error
- func DeleteVariable(ctx context.Context, id int64) error
- func FindTaskOutputKeyByTaskID(ctx context.Context, taskID int64) ([]string, error)
- func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error)
- func FixRunnersWithoutBelongingRepo(ctx context.Context) (int64, error)
- func GetActors(ctx context.Context, repoID int64) ([]*user_model.User, error)
- func GetConcurrentRunsAndJobs(ctx context.Context, repoID int64, concurrencyGroup string, status []Status) ([]*ActionRun, []*ActionRunJob, error)
- func GetCurrentTasksForRunners(ctx context.Context, runnerIDs []int64) (map[int64]*ActionTask, error)
- func GetRunIDsByRepoAndStatus(ctx context.Context, repoID int64, status Status, workflow string) ([]int64, error)
- func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, error)
- func GetSuccessRunIDsOlderThan(ctx context.Context, repoID int64, cutoff time.Time, workflow string) ([]int64, error)
- func GetTasksVersionByScope(ctx context.Context, ownerID, repoID int64) (int64, error)
- func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, error)
- func IncreaseTaskVersion(ctx context.Context, ownerID, repoID int64) error
- func InsertTaskOutputIfNotExist(ctx context.Context, taskID int64, key, value string) error
- func RequestBandwidthCheck(ctx context.Context, runnerID int64) error
- func RunnerBandwidthScore(runner *ActionRunner) float64
- func SetArtifactDeleted(ctx context.Context, artifactID int64) error
- func SetArtifactExpired(ctx context.Context, artifactID int64) error
- func SetArtifactNeedDelete(ctx context.Context, runID int64, name string) error
- func ShouldAssignJobToRunner(ctx context.Context, runner *ActionRunner, job *ActionRunJob) (bool, string)
- func StopTask(ctx context.Context, taskID int64, status Status) error
- func UpdateArtifactByID(ctx context.Context, id int64, art *ActionArtifact) error
- func UpdateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error
- func UpdateRun(ctx context.Context, run *ActionRun, cols ...string) error
- func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, cols ...string) (int64, error)
- func UpdateRunner(ctx context.Context, r *ActionRunner, cols ...string) error
- func UpdateRunnerToken(ctx context.Context, r *ActionRunnerToken, cols ...string) (err error)
- func UpdateScheduleSpec(ctx context.Context, spec *ActionScheduleSpec, cols ...string) error
- func UpdateTask(ctx context.Context, task *ActionTask, cols ...string) error
- func UpdateVariableCols(ctx context.Context, variable *ActionVariable, cols ...string) (bool, error)
- func UpdateWrongRepoLevelRunners(ctx context.Context) (int64, error)
- func UpdateWrongRepoLevelVariables(ctx context.Context) (int64, error)
- type ActionArtifact
- type ActionArtifactMeta
- type ActionJobList
- type ActionRun
- func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error)
- func GetRunByID(ctx context.Context, runID int64) (*ActionRun, error)
- func GetRunByIndex(ctx context.Context, repoID, index int64) (*ActionRun, error)
- func GetRunByRepoAndID(ctx context.Context, repoID, runID int64) (*ActionRun, error)
- func GetWorkflowLatestRun(ctx context.Context, repoID int64, workflowFile, branch, event string) (*ActionRun, error)
- func (run *ActionRun) Duration() time.Duration
- func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error)
- func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error)
- func (run *ActionRun) GetWorkflowRunEventPayload() (*api.WorkflowRunPayload, error)
- func (run *ActionRun) HTMLURL() string
- func (run *ActionRun) IsSchedule() bool
- func (run *ActionRun) Link() string
- func (run *ActionRun) LoadAttributes(ctx context.Context) error
- func (run *ActionRun) LoadRepo(ctx context.Context) error
- func (run *ActionRun) PrettyRef() string
- func (run *ActionRun) RefLink() string
- func (run *ActionRun) RefTooltip() string
- func (run *ActionRun) WorkflowLink() string
- type ActionRunIndex
- type ActionRunJob
- func CancelJobs(ctx context.Context, jobs []*ActionRunJob) ([]*ActionRunJob, error)
- func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID string, ...) ([]*ActionRunJob, error)
- func CancelPreviousJobsByJobConcurrency(ctx context.Context, job *ActionRunJob) (jobsToCancel []*ActionRunJob, _ error)
- func CancelPreviousJobsByRunConcurrency(ctx context.Context, actionRun *ActionRun) ([]*ActionRunJob, error)
- func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository) ([]*ActionRunJob, error)
- func GetRunJobByID(ctx context.Context, id int64) (*ActionRunJob, error)
- type ActionRunner
- func GetRunnerByID(ctx context.Context, id int64) (*ActionRunner, error)
- func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error)
- func GetRunnersForJobByBandwidth(ctx context.Context, job *ActionRunJob) []*ActionRunner
- func GetRunnersOfRepo(ctx context.Context, repoID int64) ([]*ActionRunner, error)
- func GetUnhealthyRunners(ctx context.Context) ([]*ActionRunner, error)
- func (r *ActionRunner) BelongsToOwnerName() string
- func (r *ActionRunner) BelongsToOwnerType() types.OwnerType
- func (r *ActionRunner) CanMatchLabels(jobRunsOn []string) bool
- func (r *ActionRunner) DisplayStatusName() string
- func (r *ActionRunner) EditableInContext(ownerID, repoID int64) bool
- func (r *ActionRunner) GenerateToken() (err error)
- func (r *ActionRunner) GetCapabilities() *RunnerCapabilities
- func (r *ActionRunner) GetHealthStatus() *RunnerHealthStatus
- func (r *ActionRunner) IsHealthy() bool
- func (r *ActionRunner) IsOnline() bool
- func (r *ActionRunner) LoadAttributes(ctx context.Context) error
- func (r *ActionRunner) NeedsCleanup() bool
- func (r *ActionRunner) Status() runnerv1.RunnerStatus
- func (r *ActionRunner) StatusLocaleName(lang translation.Locale) string
- func (r *ActionRunner) StatusName() string
- type ActionRunnerToken
- func GetLatestRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error)
- func GetRunnerToken(ctx context.Context, token string) (*ActionRunnerToken, error)
- func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error)
- func NewRunnerTokenWithValue(ctx context.Context, ownerID, repoID int64, token string) (*ActionRunnerToken, error)
- type ActionSchedule
- type ActionScheduleSpec
- type ActionTask
- func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask, bool, error)
- func FindOldTasksToExpire(ctx context.Context, olderThan timeutil.TimeStamp, limit int) ([]*ActionTask, error)
- func GetCurrentTaskByRunnerID(ctx context.Context, runnerID int64) (*ActionTask, error)
- func GetRunningTaskByToken(ctx context.Context, token string) (*ActionTask, error)
- func GetTaskByID(ctx context.Context, id int64) (*ActionTask, error)
- func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.TaskState) (*ActionTask, error)
- func (task *ActionTask) Duration() time.Duration
- func (task *ActionTask) GenerateToken() (err error)
- func (task *ActionTask) GetCommitLink() string
- func (task *ActionTask) GetRepoLink() string
- func (task *ActionTask) GetRepoName() string
- func (task *ActionTask) GetRunLink() string
- func (task *ActionTask) IsStopped() bool
- func (task *ActionTask) LoadAttributes(ctx context.Context) error
- func (task *ActionTask) LoadJob(ctx context.Context) error
- type ActionTaskOutput
- type ActionTaskStep
- type ActionTasksVersion
- type ActionVariable
- type ArtifactStatus
- type BandwidthInfo
- type CPUInfo
- type DiskInfo
- type DiskUsage
- type FindArtifactsOptions
- type FindRunJobOptions
- type FindRunOptions
- type FindRunnerOptions
- type FindScheduleOptions
- type FindSpecOptions
- type FindTaskOptions
- type FindVariablesOpts
- type LogIndexes
- type QueueDepthByLabel
- type RunList
- type RunnerBandwidthCheckRequest
- type RunnerCapabilities
- type RunnerCleanupRequest
- type RunnerHealthStatus
- type RunnerList
- type ScheduleList
- type SpecList
- type Status
- func (s Status) AsResult() runnerv1.Result
- func (s Status) HasRun() bool
- func (s Status) In(statuses ...Status) bool
- func (s Status) IsBlocked() bool
- func (s Status) IsCancelled() bool
- func (s Status) IsDone() bool
- func (s Status) IsFailure() bool
- func (s Status) IsRunning() bool
- func (s Status) IsSkipped() bool
- func (s Status) IsSuccess() bool
- func (s Status) IsUnknown() bool
- func (s Status) IsWaiting() bool
- func (s Status) LocaleString(lang translation.Locale) string
- func (s Status) String() string
- type StatusInfo
- type TaskList
Constants ¶
const ( VariableDataMaxLength = 65536 VariableDescriptionMaxLength = 4096 )
Variables ¶
This section is empty.
Functions ¶
func CanRequestCleanup ¶
CanRequestCleanup checks if we can request cleanup (respects cooldown)
func CompleteBandwidthCheckRequest ¶ added in v3.1.8
CompleteBandwidthCheckRequest marks a bandwidth check request as completed
func CompleteCleanupRequest ¶
func CompleteCleanupRequest(ctx context.Context, id int64, success bool, bytesFreed int64, errorMsg string) error
CompleteCleanupRequest marks a cleanup request as completed
func CountRunnersWithoutBelongingOwner ¶
func CountRunnersWithoutBelongingRepo ¶
func CountWrongRepoLevelRunners ¶
func CountWrongRepoLevelVariables ¶
func CreateRunner ¶
func CreateRunner(ctx context.Context, t *ActionRunner) error
CreateRunner creates new runner.
func CreateScheduleTask ¶
func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error
CreateScheduleTask creates new schedule task.
func DeleteEphemeralRunner ¶
DeleteEphemeralRunner deletes a ephemeral runner by given ID.
func DeleteRunner ¶
DeleteRunner deletes a runner by given ID.
func FindTaskOutputKeyByTaskID ¶
FindTaskOutputKeyByTaskID returns the keys of the outputs of the task.
func FixRunnersWithoutBelongingOwner ¶
func FixRunnersWithoutBelongingRepo ¶
func GetActors ¶
GetActors returns a slice of Actors
func GetConcurrentRunsAndJobs ¶
func GetCurrentTasksForRunners ¶
func GetCurrentTasksForRunners(ctx context.Context, runnerIDs []int64) (map[int64]*ActionTask, error)
GetCurrentTasksForRunners returns a map of runner ID to their current task
func GetRunIDsByRepoAndStatus ¶
func GetRunIDsByRepoAndStatus(ctx context.Context, repoID int64, status Status, workflow string) ([]int64, error)
GetRunIDsByRepoAndStatus returns all run IDs for a repository with the given status
func GetSchedulesMapByIDs ¶
GetSchedulesMapByIDs returns the schedules by given id slice.
func GetSuccessRunIDsOlderThan ¶
func GetSuccessRunIDsOlderThan(ctx context.Context, repoID int64, cutoff time.Time, workflow string) ([]int64, error)
GetSuccessRunIDsOlderThan returns IDs of successful runs older than the cutoff time
func GetTasksVersionByScope ¶
func GetVariablesOfRun ¶
func IncreaseTaskVersion ¶
func InsertTaskOutputIfNotExist ¶
InsertTaskOutputIfNotExist inserts a new task output if it does not exist.
func RequestBandwidthCheck ¶ added in v3.1.8
RequestBandwidthCheck creates a bandwidth recheck request for a runner This is used when bandwidth drops below threshold to trigger immediate recheck
func RunnerBandwidthScore ¶
func RunnerBandwidthScore(runner *ActionRunner) float64
RunnerBandwidthScore calculates a routing score for a runner Higher score = better for job assignment Score considers: bandwidth (primary), latency (secondary)
func SetArtifactDeleted ¶
SetArtifactDeleted sets an artifact to deleted
func SetArtifactExpired ¶
SetArtifactExpired sets an artifact to expired
func SetArtifactNeedDelete ¶
SetArtifactNeedDelete sets an artifact to need-delete, cron job will delete it
func ShouldAssignJobToRunner ¶
func ShouldAssignJobToRunner(ctx context.Context, runner *ActionRunner, job *ActionRunJob) (bool, string)
ShouldAssignJobToRunner determines if a job should be assigned to this runner considering bandwidth-aware routing.
IMPORTANT: This function should NEVER leave a valid runner idle when there are waiting jobs. Bandwidth routing is a preference, not a hard block. Returns: (shouldAssign bool, reason string)
func UpdateArtifactByID ¶
func UpdateArtifactByID(ctx context.Context, id int64, art *ActionArtifact) error
UpdateArtifactByID updates an artifact by id
func UpdateRepoRunsNumbers ¶
func UpdateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error
UpdateRepoRunsNumbers updates the number of runs and closed runs of a repository.
func UpdateRun ¶
UpdateRun updates a run. It requires the inputted run has Version set. It will return error if the version is not matched (it means the run has been changed after loaded).
func UpdateRunJob ¶
func UpdateRunner ¶
func UpdateRunner(ctx context.Context, r *ActionRunner, cols ...string) error
UpdateRunner updates runner's information.
func UpdateRunnerToken ¶
func UpdateRunnerToken(ctx context.Context, r *ActionRunnerToken, cols ...string) (err error)
UpdateRunnerToken updates runner token information.
func UpdateScheduleSpec ¶
func UpdateScheduleSpec(ctx context.Context, spec *ActionScheduleSpec, cols ...string) error
func UpdateVariableCols ¶
func UpdateWrongRepoLevelRunners ¶
Types ¶
type ActionArtifact ¶
type ActionArtifact struct {
ID int64 `xorm:"pk autoincr"`
RunID int64 `xorm:"index unique(runid_name_path)"` // The run id of the artifact
RunnerID int64
RepoID int64 `xorm:"index"`
OwnerID int64
CommitSHA string
StoragePath string // The path to the artifact in the storage
FileSize int64 // The size of the artifact in bytes
FileCompressedSize int64 // The size of the artifact in bytes after gzip compression
ContentEncoding string // The content encoding of the artifact
ArtifactPath string `xorm:"index unique(runid_name_path)"` // The path to the artifact when runner uploads it
ArtifactName string `xorm:"index unique(runid_name_path)"` // The name of the artifact when runner uploads it
Status ArtifactStatus `xorm:"index"` // The status of the artifact, uploading, expired or need-delete
CreatedUnix timeutil.TimeStamp `xorm:"created"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated index"`
ExpiredUnix timeutil.TimeStamp `xorm:"index"` // The time when the artifact will be expired
}
ActionArtifact is a file that is stored in the artifact storage.
func CreateArtifact ¶
func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPath string, expiredDays int64) (*ActionArtifact, error)
func ListNeedExpiredArtifacts ¶
func ListNeedExpiredArtifacts(ctx context.Context) ([]*ActionArtifact, error)
ListNeedExpiredArtifacts returns all need expired artifacts but not deleted
type ActionArtifactMeta ¶
type ActionArtifactMeta struct {
ArtifactName string
FileSize int64
Status ArtifactStatus
}
ActionArtifactMeta is the meta-data of an artifact
type ActionJobList ¶
type ActionJobList []*ActionRunJob
func GetRunJobsByRunID ¶
func GetRunJobsByRunID(ctx context.Context, runID int64) (ActionJobList, error)
func (ActionJobList) GetRunIDs ¶
func (jobs ActionJobList) GetRunIDs() []int64
func (ActionJobList) LoadAttributes ¶
func (jobs ActionJobList) LoadAttributes(ctx context.Context, withRepo bool) error
func (ActionJobList) LoadRepos ¶
func (jobs ActionJobList) LoadRepos(ctx context.Context) error
type ActionRun ¶
type ActionRun struct {
ID int64
Title string
RepoID int64 `xorm:"unique(repo_index) index(repo_concurrency)"`
Repo *repo_model.Repository `xorm:"-"`
OwnerID int64 `xorm:"index"`
WorkflowID string `xorm:"index"` // the name of workflow file
Index int64 `xorm:"index unique(repo_index)"` // a unique number for each run of a repository
TriggerUserID int64 `xorm:"index"`
TriggerUser *user_model.User `xorm:"-"`
ScheduleID int64
Ref string `xorm:"index"` // the commit/tag/… that caused the run
IsRefDeleted bool `xorm:"-"`
CommitSHA string
IsForkPullRequest bool // If this is triggered by a PR from a forked repository or an untrusted user, we need to check if it is approved and limit permissions when running the workflow.
NeedApproval bool // may need approval if it's a fork pull request
ApprovedBy int64 `xorm:"index"` // who approved
Event webhook_module.HookEventType // the webhook event that causes the workflow to run
EventPayload string `xorm:"LONGTEXT"`
TriggerEvent string // the trigger event defined in the `on` configuration of the triggered workflow
Status Status `xorm:"index"`
Version int `xorm:"version default 0"` // Status could be updated concomitantly, so an optimistic lock is needed
RawConcurrency string // raw concurrency
ConcurrencyGroup string `xorm:"index(repo_concurrency) NOT NULL DEFAULT ''"`
ConcurrencyCancel bool `xorm:"NOT NULL DEFAULT FALSE"`
// Started and Stopped is used for recording last run time, if rerun happened, they will be reset to 0
Started timeutil.TimeStamp
Stopped timeutil.TimeStamp
// PreviousDuration is used for recording previous duration
PreviousDuration time.Duration
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionRun represents a run of a workflow file
func GetRunByID ¶
GetRunByID returns an action run by its ID
func GetRunByIndex ¶
func GetRunByRepoAndID ¶
func GetWorkflowLatestRun ¶
func (*ActionRun) GetPullRequestEventPayload ¶
func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error)
func (*ActionRun) GetPushEventPayload ¶
func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error)
func (*ActionRun) GetWorkflowRunEventPayload ¶
func (run *ActionRun) GetWorkflowRunEventPayload() (*api.WorkflowRunPayload, error)
func (*ActionRun) LoadAttributes ¶
LoadAttributes load Repo TriggerUser if not loaded
func (*ActionRun) PrettyRef ¶
PrettyRef return #id for pull ref or ShortName for others
func (*ActionRun) RefLink ¶
RefLink return the url of run's ref
func (*ActionRun) RefTooltip ¶
RefTooltip return a tooltop of run's ref. For pull request, it's the title of the PR, otherwise it's the ShortName.
type ActionRunIndex ¶
type ActionRunIndex db.ResourceIndex
type ActionRunJob ¶
type ActionRunJob struct {
ID int64
RunID int64 `xorm:"index"`
Run *ActionRun `xorm:"-"`
RepoID int64 `xorm:"index(repo_concurrency)"`
Repo *repo_model.Repository `xorm:"-"`
OwnerID int64 `xorm:"index"`
CommitSHA string `xorm:"index"`
IsForkPullRequest bool
Name string `xorm:"VARCHAR(255)"`
Attempt int64
// WorkflowPayload is act/jobparser.SingleWorkflow for act/jobparser.Parse
// it should contain exactly one job with global workflow fields for this model
WorkflowPayload []byte
JobID string `xorm:"VARCHAR(255)"` // job id in workflow, not job's id
Needs []string `xorm:"JSON TEXT"`
RunsOn []string `xorm:"JSON TEXT"`
TaskID int64 // the latest task of the job
Status Status `xorm:"index"`
RawConcurrency string // raw concurrency from job YAML's "concurrency" section
// IsConcurrencyEvaluated is only valid/needed when this job's RawConcurrency is not empty.
// If RawConcurrency can't be evaluated (e.g. depend on other job's outputs or have errors), this field will be false.
// If RawConcurrency has been successfully evaluated, this field will be true, ConcurrencyGroup and ConcurrencyCancel are also set.
IsConcurrencyEvaluated bool
ConcurrencyGroup string `xorm:"index(repo_concurrency) NOT NULL DEFAULT ''"` // evaluated concurrency.group
ConcurrencyCancel bool `xorm:"NOT NULL DEFAULT FALSE"` // evaluated concurrency.cancel-in-progress
Started timeutil.TimeStamp
Stopped timeutil.TimeStamp
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated index"`
}
ActionRunJob represents a job of a run
func CancelJobs ¶
func CancelJobs(ctx context.Context, jobs []*ActionRunJob) ([]*ActionRunJob, error)
func CancelPreviousJobs ¶
func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID string, event webhook_module.HookEventType) ([]*ActionRunJob, error)
CancelPreviousJobs cancels all previous jobs of the same repository, reference, workflow, and event. It's useful when a new run is triggered, and all previous runs needn't be continued anymore.
func CancelPreviousJobsByJobConcurrency ¶
func CancelPreviousJobsByJobConcurrency(ctx context.Context, job *ActionRunJob) (jobsToCancel []*ActionRunJob, _ error)
func CancelPreviousJobsByRunConcurrency ¶
func CancelPreviousJobsByRunConcurrency(ctx context.Context, actionRun *ActionRun) ([]*ActionRunJob, error)
func CleanRepoScheduleTasks ¶
func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository) ([]*ActionRunJob, error)
func (*ActionRunJob) Duration ¶
func (job *ActionRunJob) Duration() time.Duration
func (*ActionRunJob) LoadAttributes ¶
func (job *ActionRunJob) LoadAttributes(ctx context.Context) error
LoadAttributes load Run if not loaded
func (*ActionRunJob) LoadRepo ¶
func (job *ActionRunJob) LoadRepo(ctx context.Context) error
func (*ActionRunJob) LoadRun ¶
func (job *ActionRunJob) LoadRun(ctx context.Context) error
func (*ActionRunJob) ParseJob ¶
func (job *ActionRunJob) ParseJob() (*jobparser.Job, error)
ParseJob parses the job structure from the ActionRunJob.WorkflowPayload
type ActionRunner ¶
type ActionRunner struct {
ID int64
UUID string `xorm:"CHAR(36) UNIQUE"`
Name string `xorm:"VARCHAR(255)"`
Version string `xorm:"VARCHAR(64)"`
OwnerID int64 `xorm:"index"`
Owner *user_model.User `xorm:"-"`
RepoID int64 `xorm:"index"`
Repo *repo_model.Repository `xorm:"-"`
Description string `xorm:"TEXT"`
Base int // 0 native 1 docker 2 virtual machine
RepoRange string // glob match which repositories could use this runner
Token string `xorm:"-"`
TokenHash string `xorm:"UNIQUE"` // sha256 of token
TokenSalt string
LastOnline timeutil.TimeStamp `xorm:"index"`
LastActive timeutil.TimeStamp `xorm:"index"`
// Store labels defined in state file (default: .runner file) of `act_runner`
AgentLabels []string `xorm:"TEXT"`
// Store if this is a runner that only ever get one single job assigned
Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"`
// CapabilitiesJSON stores structured capability information for AI consumption
CapabilitiesJSON string `xorm:"TEXT"`
// BandwidthTestRequestedAt tracks when a bandwidth test was requested by admin
BandwidthTestRequestedAt timeutil.TimeStamp `xorm:"index"`
// CleanupRequestedAt tracks when a force cleanup was requested by admin
CleanupRequestedAt timeutil.TimeStamp `xorm:"index"`
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
Deleted timeutil.TimeStamp `xorm:"deleted"`
}
ActionRunner represents runner machines
It can be:
- global runner, OwnerID is 0 and RepoID is 0
- org/user level runner, OwnerID is org/user ID and RepoID is 0
- repo level runner, OwnerID is 0 and RepoID is repo ID
Please note that it's not acceptable to have both OwnerID and RepoID to be non-zero, or it will be complicated to find runners belonging to a specific owner. For example, conditions like `OwnerID = 1` will also return runner {OwnerID: 1, RepoID: 1}, but it's a repo level runner, not an org/user level runner. To avoid this, make it clear with {OwnerID: 0, RepoID: 1} for repo level runners.
func GetRunnerByID ¶
func GetRunnerByID(ctx context.Context, id int64) (*ActionRunner, error)
GetRunnerByID returns a runner via id
func GetRunnerByUUID ¶
func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error)
GetRunnerByUUID returns a runner via uuid
func GetRunnersForJobByBandwidth ¶
func GetRunnersForJobByBandwidth(ctx context.Context, job *ActionRunJob) []*ActionRunner
GetRunnersForJobByBandwidth returns runners sorted by bandwidth score (best first)
func GetRunnersOfRepo ¶
func GetRunnersOfRepo(ctx context.Context, repoID int64) ([]*ActionRunner, error)
GetRunnersOfRepo returns all runners available for a repository This includes repo-level, owner-level, and global runners
func GetUnhealthyRunners ¶
func GetUnhealthyRunners(ctx context.Context) ([]*ActionRunner, error)
GetUnhealthyRunners returns all runners that are unhealthy
func (*ActionRunner) BelongsToOwnerName ¶
func (r *ActionRunner) BelongsToOwnerName() string
BelongsToOwnerName before calling, should guarantee that all attributes are loaded
func (*ActionRunner) BelongsToOwnerType ¶
func (r *ActionRunner) BelongsToOwnerType() types.OwnerType
func (*ActionRunner) CanMatchLabels ¶
func (r *ActionRunner) CanMatchLabels(jobRunsOn []string) bool
CanMatchLabels checks whether the runner's labels can match a job's "runs-on" See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idruns-on
func (*ActionRunner) DisplayStatusName ¶
func (r *ActionRunner) DisplayStatusName() string
DisplayStatusName returns the status name for display, considering health status Returns "unhealthy" if the runner is online but has health issues
func (*ActionRunner) EditableInContext ¶
func (r *ActionRunner) EditableInContext(ownerID, repoID int64) bool
EditableInContext checks if the runner is editable by the "context" owner/repo ownerID == 0 and repoID == 0 means "admin" context, any runner including global runners could be edited ownerID == 0 and repoID != 0 means "repo" context, any runner belonging to the given repo could be edited ownerID != 0 and repoID == 0 means "owner(org/user)" context, any runner belonging to the given user/org could be edited ownerID != 0 and repoID != 0 means "owner" OR "repo" context, legacy behavior, but we should forbid using it
func (*ActionRunner) GenerateToken ¶
func (r *ActionRunner) GenerateToken() (err error)
func (*ActionRunner) GetCapabilities ¶
func (r *ActionRunner) GetCapabilities() *RunnerCapabilities
GetCapabilities parses and returns the runner's capabilities
func (*ActionRunner) GetHealthStatus ¶
func (r *ActionRunner) GetHealthStatus() *RunnerHealthStatus
GetHealthStatus returns detailed health status of the runner Note: Only critical resource exhaustion blocks job assignment: - Disk usage >= 95% - CPU load >= 95% - Bandwidth < 1 MB/s (8 Mbps) - triggers recheck Latency is informational only and doesn't block job assignment.
func (*ActionRunner) IsHealthy ¶
func (r *ActionRunner) IsHealthy() bool
IsHealthy returns true if the runner is healthy enough for job assignment
func (*ActionRunner) IsOnline ¶
func (r *ActionRunner) IsOnline() bool
func (*ActionRunner) LoadAttributes ¶
func (r *ActionRunner) LoadAttributes(ctx context.Context) error
LoadAttributes loads the attributes of the runner
func (*ActionRunner) NeedsCleanup ¶
func (r *ActionRunner) NeedsCleanup() bool
NeedsCleanup returns true if the runner should perform cleanup
func (*ActionRunner) Status ¶
func (r *ActionRunner) Status() runnerv1.RunnerStatus
if the logic here changed, you should also modify FindRunnerOptions.ToCond
func (*ActionRunner) StatusLocaleName ¶
func (r *ActionRunner) StatusLocaleName(lang translation.Locale) string
func (*ActionRunner) StatusName ¶
func (r *ActionRunner) StatusName() string
type ActionRunnerToken ¶
type ActionRunnerToken struct {
ID int64
Token string `xorm:"UNIQUE"`
OwnerID int64 `xorm:"index"`
Owner *user_model.User `xorm:"-"`
RepoID int64 `xorm:"index"`
Repo *repo_model.Repository `xorm:"-"`
IsActive bool // true means it can be used
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
Deleted timeutil.TimeStamp `xorm:"deleted"`
}
ActionRunnerToken represents runner tokens
It can be:
- global token, OwnerID is 0 and RepoID is 0
- org/user level token, OwnerID is org/user ID and RepoID is 0
- repo level token, OwnerID is 0 and RepoID is repo ID
Please note that it's not acceptable to have both OwnerID and RepoID to be non-zero, or it will be complicated to find tokens belonging to a specific owner. For example, conditions like `OwnerID = 1` will also return token {OwnerID: 1, RepoID: 1}, but it's a repo level token, not an org/user level token. To avoid this, make it clear with {OwnerID: 0, RepoID: 1} for repo level tokens.
func GetLatestRunnerToken ¶
func GetLatestRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error)
GetLatestRunnerToken returns the latest runner token
func GetRunnerToken ¶
func GetRunnerToken(ctx context.Context, token string) (*ActionRunnerToken, error)
GetRunnerToken returns a action runner via token
type ActionSchedule ¶
type ActionSchedule struct {
ID int64
Title string
Specs []string
RepoID int64 `xorm:"index"`
Repo *repo_model.Repository `xorm:"-"`
OwnerID int64 `xorm:"index"`
WorkflowID string
TriggerUserID int64
TriggerUser *user_model.User `xorm:"-"`
Ref string
CommitSHA string
Event webhook_module.HookEventType
EventPayload string `xorm:"LONGTEXT"`
Content []byte
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionSchedule represents a schedule of a workflow file
func (*ActionSchedule) ToActionRun ¶
func (s *ActionSchedule) ToActionRun() *ActionRun
best effort function to convert an action schedule to action run, to be used in GenerateGiteaContext
type ActionScheduleSpec ¶
type ActionScheduleSpec struct {
ID int64
RepoID int64 `xorm:"index"`
Repo *repo_model.Repository `xorm:"-"`
ScheduleID int64 `xorm:"index"`
Schedule *ActionSchedule `xorm:"-"`
// Next time the job will run, or the zero time if Cron has not been
// started or this entry's schedule is unsatisfiable
Next timeutil.TimeStamp `xorm:"index"`
// Prev is the last time this job was run, or the zero time if never.
Prev timeutil.TimeStamp
Spec string
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionScheduleSpec represents a schedule spec of a workflow file
func (*ActionScheduleSpec) Parse ¶
func (s *ActionScheduleSpec) Parse() (cron.Schedule, error)
Parse parses the spec and returns a cron.Schedule Unlike the default cron parser, Parse uses UTC timezone as the default if none is specified.
type ActionTask ¶
type ActionTask struct {
ID int64
JobID int64
Job *ActionRunJob `xorm:"-"`
Steps []*ActionTaskStep `xorm:"-"`
Attempt int64
RunnerID int64 `xorm:"index"`
Status Status `xorm:"index"`
Started timeutil.TimeStamp `xorm:"index"`
Stopped timeutil.TimeStamp `xorm:"index(stopped_log_expired)"`
RepoID int64 `xorm:"index"`
OwnerID int64 `xorm:"index"`
CommitSHA string `xorm:"index"`
IsForkPullRequest bool
Token string `xorm:"-"`
TokenHash string `xorm:"UNIQUE"` // sha256 of token
TokenSalt string
TokenLastEight string `xorm:"index token_last_eight"`
LogFilename string // file name of log
LogInStorage bool // read log from database or from storage
LogLength int64 // lines count
LogSize int64 // blob size
LogIndexes LogIndexes `xorm:"LONGBLOB"` // line number to offset
LogExpired bool `xorm:"index(stopped_log_expired)"` // files that are too old will be deleted
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated index"`
}
ActionTask represents a distribution of job
func CreateTaskForRunner ¶
func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask, bool, error)
CreateTaskForRunner creates a task for a runner. It checks runner health before assigning jobs and skips unhealthy runners.
func FindOldTasksToExpire ¶
func GetCurrentTaskByRunnerID ¶
func GetCurrentTaskByRunnerID(ctx context.Context, runnerID int64) (*ActionTask, error)
GetCurrentTaskByRunnerID returns the currently running task for a runner
func GetRunningTaskByToken ¶
func GetRunningTaskByToken(ctx context.Context, token string) (*ActionTask, error)
func UpdateTaskByState ¶
func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.TaskState) (*ActionTask, error)
UpdateTaskByState updates the task by the state. It will always update the task if the state is not final, even there is no change. So it will update ActionTask.Updated to avoid the task being judged as a zombie task.
func (*ActionTask) Duration ¶
func (task *ActionTask) Duration() time.Duration
func (*ActionTask) GenerateToken ¶
func (task *ActionTask) GenerateToken() (err error)
func (*ActionTask) GetCommitLink ¶
func (task *ActionTask) GetCommitLink() string
func (*ActionTask) GetRepoLink ¶
func (task *ActionTask) GetRepoLink() string
func (*ActionTask) GetRepoName ¶
func (task *ActionTask) GetRepoName() string
func (*ActionTask) GetRunLink ¶
func (task *ActionTask) GetRunLink() string
func (*ActionTask) IsStopped ¶
func (task *ActionTask) IsStopped() bool
func (*ActionTask) LoadAttributes ¶
func (task *ActionTask) LoadAttributes(ctx context.Context) error
LoadAttributes load Job Steps if not loaded
func (*ActionTask) LoadJob ¶
func (task *ActionTask) LoadJob(ctx context.Context) error
type ActionTaskOutput ¶
type ActionTaskOutput struct {
ID int64
TaskID int64 `xorm:"INDEX UNIQUE(task_id_output_key)"`
OutputKey string `xorm:"VARCHAR(255) UNIQUE(task_id_output_key)"`
OutputValue string `xorm:"MEDIUMTEXT"`
}
ActionTaskOutput represents an output of ActionTask. So the outputs are bound to a task, that means when a completed job has been rerun, the outputs of the job will be reset because the task is new. It's by design, to avoid the outputs of the old task to be mixed with the new task.
type ActionTaskStep ¶
type ActionTaskStep struct {
ID int64
Name string `xorm:"VARCHAR(255)"`
TaskID int64 `xorm:"index unique(task_index)"`
Index int64 `xorm:"index unique(task_index)"`
RepoID int64 `xorm:"index"`
Status Status `xorm:"index"`
LogIndex int64
LogLength int64
Started timeutil.TimeStamp
Stopped timeutil.TimeStamp
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionTaskStep represents a step of ActionTask
func GetTaskStepsByTaskID ¶
func GetTaskStepsByTaskID(ctx context.Context, taskID int64) ([]*ActionTaskStep, error)
func (*ActionTaskStep) Duration ¶
func (step *ActionTaskStep) Duration() time.Duration
type ActionTasksVersion ¶
type ActionTasksVersion struct {
ID int64 `xorm:"pk autoincr"`
OwnerID int64 `xorm:"UNIQUE(owner_repo)"`
RepoID int64 `xorm:"INDEX UNIQUE(owner_repo)"`
Version int64
CreatedUnix timeutil.TimeStamp `xorm:"created"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
}
ActionTasksVersion If both ownerID and repoID is zero, its scope is global. If ownerID is not zero and repoID is zero, its scope is org (there is no user-level runner currently). If ownerID is zero and repoID is not zero, its scope is repo.
type ActionVariable ¶
type ActionVariable struct {
ID int64 `xorm:"pk autoincr"`
OwnerID int64 `xorm:"UNIQUE(owner_repo_name)"`
RepoID int64 `xorm:"INDEX UNIQUE(owner_repo_name)"`
Name string `xorm:"UNIQUE(owner_repo_name) NOT NULL"`
Data string `xorm:"LONGTEXT NOT NULL"`
Description string `xorm:"TEXT"`
CreatedUnix timeutil.TimeStamp `xorm:"created NOT NULL"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
}
ActionVariable represents a variable that can be used in actions
It can be:
- global variable, OwnerID is 0 and RepoID is 0
- org/user level variable, OwnerID is org/user ID and RepoID is 0
- repo level variable, OwnerID is 0 and RepoID is repo ID
Please note that it's not acceptable to have both OwnerID and RepoID to be non-zero, or it will be complicated to find variables belonging to a specific owner. For example, conditions like `OwnerID = 1` will also return variable {OwnerID: 1, RepoID: 1}, but it's a repo level variable, not an org/user level variable. To avoid this, make it clear with {OwnerID: 0, RepoID: 1} for repo level variables.
func FindVariables ¶
func FindVariables(ctx context.Context, opts FindVariablesOpts) ([]*ActionVariable, error)
type ArtifactStatus ¶
type ArtifactStatus int64
ArtifactStatus is the status of an artifact, uploading, expired or need-delete
const ( ArtifactStatusUploadPending ArtifactStatus = iota + 1 // 1, ArtifactStatusUploadPending is the status of an artifact upload that is pending ArtifactStatusUploadConfirmed // 2, ArtifactStatusUploadConfirmed is the status of an artifact upload that is confirmed ArtifactStatusUploadError // 3, ArtifactStatusUploadError is the status of an artifact upload that is errored ArtifactStatusExpired // 4, ArtifactStatusExpired is the status of an artifact that is expired ArtifactStatusPendingDeletion // 5, ArtifactStatusPendingDeletion is the status of an artifact that is pending deletion ArtifactStatusDeleted // 6, ArtifactStatusDeleted is the status of an artifact that is deleted )
func (ArtifactStatus) ToString ¶
func (status ArtifactStatus) ToString() string
type BandwidthInfo ¶
type BandwidthInfo struct {
DownloadMbps float64 `json:"download_mbps"`
LatencyMs float64 `json:"latency_ms"`
TestedAt time.Time `json:"tested_at"`
}
BandwidthInfo contains network performance information
type CPUInfo ¶
type CPUInfo struct {
NumCPU int `json:"num_cpu"` // Number of logical CPUs
LoadAvg1m float64 `json:"load_avg_1m"` // 1-minute load average
LoadAvg5m float64 `json:"load_avg_5m"` // 5-minute load average
LoadAvg15m float64 `json:"load_avg_15m"` // 15-minute load average
LoadPercent float64 `json:"load_percent"` // (load_avg_1m / num_cpu) * 100
}
CPUInfo contains CPU load information
type DiskInfo ¶
type DiskInfo struct {
TotalBytes int64 `json:"total_bytes"`
FreeBytes int64 `json:"free_bytes"`
UsedBytes int64 `json:"used_bytes"`
UsedPercent float64 `json:"used_percent"`
}
DiskInfo contains disk usage information
type DiskUsage ¶
type DiskUsage struct {
Status Status `json:"status"`
RunCount int64 `json:"run_count"`
LogSize int64 `json:"log_size"`
ArtifactSize int64 `json:"artifact_size"`
TotalSize int64 `json:"total_size"`
}
DiskUsage holds disk space usage breakdown by status for a repository
type FindArtifactsOptions ¶
type FindArtifactsOptions struct {
db.ListOptions
RepoID int64
RunID int64
ArtifactName string
Status int
FinalizedArtifactsV4 bool
}
func (FindArtifactsOptions) ToConds ¶
func (opts FindArtifactsOptions) ToConds() builder.Cond
func (FindArtifactsOptions) ToOrders ¶
func (opts FindArtifactsOptions) ToOrders() string
type FindRunJobOptions ¶
type FindRunJobOptions struct {
db.ListOptions
RunID int64
RepoID int64
OwnerID int64
CommitSHA string
Statuses []Status
UpdatedBefore timeutil.TimeStamp
ConcurrencyGroup string
}
func (FindRunJobOptions) ToConds ¶
func (opts FindRunJobOptions) ToConds() builder.Cond
func (FindRunJobOptions) ToJoins ¶
func (opts FindRunJobOptions) ToJoins() []db.JoinFunc
type FindRunOptions ¶
type FindRunOptions struct {
db.ListOptions
RepoID int64
OwnerID int64
WorkflowID string
Ref string // the commit/tag/… that caused this workflow
TriggerUserID int64
TriggerEvent webhook_module.HookEventType
Approved bool // not util.OptionalBool, it works only when it's true
Status []Status
ConcurrencyGroup string
CommitSHA string
}
func (FindRunOptions) ToConds ¶
func (opts FindRunOptions) ToConds() builder.Cond
func (FindRunOptions) ToJoins ¶
func (opts FindRunOptions) ToJoins() []db.JoinFunc
func (FindRunOptions) ToOrders ¶
func (opts FindRunOptions) ToOrders() string
type FindRunnerOptions ¶
type FindRunnerOptions struct {
db.ListOptions
IDs []int64
RepoID int64
OwnerID int64 // it will be ignored if RepoID is set
Sort string
Filter string
IsOnline optional.Option[bool]
WithAvailable bool // not only runners belong to, but also runners can be used
}
FindRunnerOptions ownerID == 0 and repoID == 0 means any runner including global runners repoID != 0 and WithAvailable == false means any runner for the given repo repoID != 0 and WithAvailable == true means any runner for the given repo, parent user/org, and global runners ownerID != 0 and repoID == 0 and WithAvailable == false means any runner for the given user/org ownerID != 0 and repoID == 0 and WithAvailable == true means any runner for the given user/org and global runners
func (FindRunnerOptions) ToConds ¶
func (opts FindRunnerOptions) ToConds() builder.Cond
func (FindRunnerOptions) ToOrders ¶
func (opts FindRunnerOptions) ToOrders() string
type FindScheduleOptions ¶
type FindScheduleOptions struct {
db.ListOptions
RepoID int64
OwnerID int64
}
func (FindScheduleOptions) ToConds ¶
func (opts FindScheduleOptions) ToConds() builder.Cond
func (FindScheduleOptions) ToOrders ¶
func (opts FindScheduleOptions) ToOrders() string
type FindSpecOptions ¶
type FindSpecOptions struct {
db.ListOptions
RepoID int64
Next int64
}
func (FindSpecOptions) ToConds ¶
func (opts FindSpecOptions) ToConds() builder.Cond
func (FindSpecOptions) ToOrders ¶
func (opts FindSpecOptions) ToOrders() string
type FindTaskOptions ¶
type FindTaskOptions struct {
db.ListOptions
RepoID int64
JobID int64
OwnerID int64
CommitSHA string
Status Status
UpdatedBefore timeutil.TimeStamp
StartedBefore timeutil.TimeStamp
RunnerID int64
}
func (FindTaskOptions) ToConds ¶
func (opts FindTaskOptions) ToConds() builder.Cond
func (FindTaskOptions) ToOrders ¶
func (opts FindTaskOptions) ToOrders() string
type FindVariablesOpts ¶
type FindVariablesOpts struct {
db.ListOptions
IDs []int64
RepoID int64
OwnerID int64 // it will be ignored if RepoID is set
Name string
}
func (FindVariablesOpts) ToConds ¶
func (opts FindVariablesOpts) ToConds() builder.Cond
type LogIndexes ¶
type LogIndexes []int64
LogIndexes is the index for mapping log line number to buffer offset. Because it uses varint encoding, it is impossible to predict its size. But we can make a simple estimate with an assumption that each log line has 200 byte, then: | lines | file size | index size | |-----------|---------------------|--------------------| | 100 | 20 KiB(20000) | 258 B(258) | | 1000 | 195 KiB(200000) | 2.9 KiB(2958) | | 10000 | 1.9 MiB(2000000) | 34 KiB(34715) | | 100000 | 19 MiB(20000000) | 386 KiB(394715) | | 1000000 | 191 MiB(200000000) | 4.1 MiB(4323626) | | 10000000 | 1.9 GiB(2000000000) | 47 MiB(49323626) | | 100000000 | 19 GiB(20000000000) | 490 MiB(513424280) |
func (*LogIndexes) FromDB ¶
func (indexes *LogIndexes) FromDB(b []byte) error
func (*LogIndexes) ToDB ¶
func (indexes *LogIndexes) ToDB() ([]byte, error)
type QueueDepthByLabel ¶
type QueueDepthByLabel struct {
Label string
JobCount int64
StuckJobs int64 // Jobs waiting > 30 minutes
OldestWait timeutil.TimeStamp // Created time of oldest waiting job
}
QueueDepthByLabel represents waiting jobs count for a label
func GetQueueDepthByLabels ¶
func GetQueueDepthByLabels(ctx context.Context) ([]QueueDepthByLabel, error)
GetQueueDepthByLabels returns the count of waiting jobs grouped by their runs_on labels
type RunList ¶
type RunList []*ActionRun
func (RunList) GetUserIDs ¶
GetUserIDs returns a slice of user's id
type RunnerBandwidthCheckRequest ¶ added in v3.1.8
type RunnerBandwidthCheckRequest struct {
ID int64 `xorm:"pk autoincr"`
RunnerID int64 `xorm:"INDEX NOT NULL"`
RequestedAt timeutil.TimeStamp `xorm:"created INDEX"`
CompletedAt timeutil.TimeStamp `xorm:"INDEX"`
OldMbps float64 // Bandwidth before recheck
NewMbps float64 // Bandwidth after recheck
}
RunnerBandwidthCheckRequest tracks bandwidth recheck requests sent to runners
func GetPendingBandwidthCheckRequest ¶ added in v3.1.8
func GetPendingBandwidthCheckRequest(ctx context.Context, runnerID int64) (*RunnerBandwidthCheckRequest, error)
GetPendingBandwidthCheckRequest returns the pending bandwidth check request for a runner
func (RunnerBandwidthCheckRequest) TableName ¶ added in v3.1.8
func (RunnerBandwidthCheckRequest) TableName() string
TableName returns the table name for RunnerBandwidthCheckRequest
type RunnerCapabilities ¶
type RunnerCapabilities struct {
OS string `json:"os"`
Arch string `json:"arch"`
Disk *DiskInfo `json:"disk"`
CPU *CPUInfo `json:"cpu"`
Bandwidth *BandwidthInfo `json:"bandwidth"`
}
RunnerCapabilities represents the parsed capabilities from CapabilitiesJSON
type RunnerCleanupRequest ¶
type RunnerCleanupRequest struct {
ID int64 `xorm:"pk autoincr"`
RunnerID int64 `xorm:"INDEX NOT NULL"`
RequestedAt timeutil.TimeStamp `xorm:"created INDEX"`
CompletedAt timeutil.TimeStamp `xorm:"INDEX"`
Success bool
BytesFreed int64
ErrorMsg string `xorm:"TEXT"`
}
RunnerCleanupRequest tracks cleanup requests sent to runners
func CreateCleanupRequest ¶
func CreateCleanupRequest(ctx context.Context, runnerID int64) (*RunnerCleanupRequest, error)
CreateCleanupRequest creates a new cleanup request for a runner
func GetLastCleanupRequest ¶
func GetLastCleanupRequest(ctx context.Context, runnerID int64) (*RunnerCleanupRequest, error)
GetLastCleanupRequest returns the last cleanup request for a runner
func GetPendingCleanupRequest ¶
func GetPendingCleanupRequest(ctx context.Context, runnerID int64) (*RunnerCleanupRequest, error)
GetPendingCleanupRequest returns the pending (uncompleted) cleanup request for a runner
func (RunnerCleanupRequest) TableName ¶
func (RunnerCleanupRequest) TableName() string
TableName returns the table name for RunnerCleanupRequest
type RunnerHealthStatus ¶
type RunnerHealthStatus struct {
Healthy bool `json:"healthy"`
DiskHealthy bool `json:"disk_healthy"`
CPUHealthy bool `json:"cpu_healthy"`
LatencyHealthy bool `json:"latency_healthy"`
BandwidthHealthy bool `json:"bandwidth_healthy"`
DiskUsedPercent float64 `json:"disk_used_percent"`
DiskFreeBytes int64 `json:"disk_free_bytes"`
CPULoadPercent float64 `json:"cpu_load_percent"`
LatencyMs float64 `json:"latency_ms"`
BandwidthMbps float64 `json:"bandwidth_mbps"`
Reason string `json:"reason,omitempty"`
NeedsCleanup bool `json:"needs_cleanup"`
NeedsBandwidthCheck bool `json:"needs_bandwidth_check"`
}
RunnerHealthStatus represents the health status of a runner
type RunnerList ¶
type RunnerList []*ActionRunner
func (RunnerList) GetUserIDs ¶
func (runners RunnerList) GetUserIDs() []int64
GetUserIDs returns a slice of user's id
func (RunnerList) LoadAttributes ¶
func (runners RunnerList) LoadAttributes(ctx context.Context) error
func (RunnerList) LoadOwners ¶
func (runners RunnerList) LoadOwners(ctx context.Context) error
func (RunnerList) LoadRepos ¶
func (runners RunnerList) LoadRepos(ctx context.Context) error
type ScheduleList ¶
type ScheduleList []*ActionSchedule
func (ScheduleList) GetRepoIDs ¶
func (schedules ScheduleList) GetRepoIDs() []int64
func (ScheduleList) GetUserIDs ¶
func (schedules ScheduleList) GetUserIDs() []int64
GetUserIDs returns a slice of user's id
func (ScheduleList) LoadRepos ¶
func (schedules ScheduleList) LoadRepos(ctx context.Context) error
func (ScheduleList) LoadTriggerUser ¶
func (schedules ScheduleList) LoadTriggerUser(ctx context.Context) error
type SpecList ¶
type SpecList []*ActionScheduleSpec
type Status ¶
type Status int
Status represents the status of ActionRun, ActionRunJob, ActionTask, or ActionTaskStep
const ( StatusUnknown Status = iota // 0, consistent with runnerv1.Result_RESULT_UNSPECIFIED StatusSuccess // 1, consistent with runnerv1.Result_RESULT_SUCCESS StatusFailure // 2, consistent with runnerv1.Result_RESULT_FAILURE StatusCancelled // 3, consistent with runnerv1.Result_RESULT_CANCELLED StatusSkipped // 4, consistent with runnerv1.Result_RESULT_SKIPPED StatusWaiting // 5, isn't a runnerv1.Result StatusRunning // 6, isn't a runnerv1.Result StatusBlocked // 7, isn't a runnerv1.Result )
func AggregateJobStatus ¶
func AggregateJobStatus(jobs []*ActionRunJob) Status
func (Status) HasRun ¶
HasRun returns whether the Status is a result of running
func (Status) In ¶
In returns whether s is one of the given statuses
func (Status) LocaleString ¶
func (s Status) LocaleString(lang translation.Locale) string
LocaleString returns the locale string name of the Status
type StatusInfo ¶
func GetStatusInfoList ¶
func GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInfo
GetStatusInfoList returns a slice of StatusInfo
Source Files
¶
- artifact.go
- run.go
- run_job.go
- run_job_list.go
- run_list.go
- runner.go
- runner_health.go
- runner_list.go
- runner_routing.go
- runner_token.go
- schedule.go
- schedule_list.go
- schedule_spec.go
- schedule_spec_list.go
- status.go
- task.go
- task_list.go
- task_output.go
- task_step.go
- tasks_version.go
- utils.go
- variable.go