Documentation
¶
Index ¶
- Constants
- Variables
- func AddScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) error
- func ComputeTaskTokenPermissions(ctx context.Context, task *ActionTask, targetRepo *repo_model.Repository) (ret repo_model.ActionsTokenPermissions, err 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 DeleteActionRunJobSummary(ctx context.Context, repoID, runID, runAttemptID, jobID, stepIndex int64) 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 GetConcurrentRunAttemptsAndJobs(ctx context.Context, repoID int64, concurrencyGroup string, status []Status) ([]*ActionRunAttempt, []*ActionRunJob, error)
- func GetNextAttemptJobID(ctx context.Context, runID int64) (int64, error)
- func GetPriorAttemptChildrenByParent(ctx context.Context, runID, currentAttemptID, parentAttemptJobID int64) (map[string]map[string]*ActionRunJob, error)
- func GetRepoRunWorkflowIDs(ctx context.Context, repoID int64) ([]string, error)
- func GetRunBranches(ctx context.Context, repoID int64) ([]string, error)
- func GetRunWorkflowIDs(ctx context.Context, repoID int64) ([]string, error)
- func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, 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 IsScopedWorkflowOptedOut(ctx context.Context, cfg *repo_model.ActionsConfig, ...) (bool, error)
- func IsScopedWorkflowRequired(ctx context.Context, consumerOwnerID, sourceRepoID int64, workflowID string) (bool, error)
- func IsScopedWorkflowSourceEffective(ctx context.Context, repoOwnerID, sourceRepoID int64) (bool, error)
- func IsWorkflowRequiredInSources(sources []*ActionScopedWorkflowSource, sourceRepoID int64, workflowID string) bool
- func RefreshReusableCallerStatus(ctx context.Context, caller *ActionRunJob) error
- func ReleaseTaskForRunner(ctx context.Context, task *ActionTask) error
- func RemoveScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) error
- func RunnerCapabilities() string
- func ScopedStatusContextPrefix(ctx context.Context, sourceRepoID int64) string
- func ScopedWorkflowOptedOut(cfg *repo_model.ActionsConfig, sources []*ActionScopedWorkflowSource, ...) bool
- func SetArtifactDeleted(ctx context.Context, artifactID int64) error
- func SetArtifactExpired(ctx context.Context, artifactID int64) error
- func SetArtifactNeedDeleteByID(ctx context.Context, artifactID int64) error
- func SetArtifactNeedDeleteByRunAttempt(ctx context.Context, runID, runAttemptID int64, name string) error
- func SetOwnerActionsConfig(ctx context.Context, userID int64, cfg OwnerActionsConfig) error
- func SetRunnerDisabled(ctx context.Context, runner *ActionRunner, isDisabled bool) error
- func SetScopedWorkflowSourceConfigs(ctx context.Context, ownerID, repoID int64, ...) error
- func ShouldPersistLastActive(last timeutil.TimeStamp, now time.Time) bool
- func ShouldPersistLastOnline(last timeutil.TimeStamp, now time.Time) bool
- 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, repoID int64)
- func UpdateRun(ctx context.Context, run *ActionRun, cols ...string) error
- func UpdateRunAttempt(ctx context.Context, attempt *ActionRunAttempt, 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)
- func UpsertActionRunJobSummary(ctx context.Context, repoID, runID, runAttemptID, jobID, stepIndex int64, ...) error
- type ActionArtifact
- func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPath string, ...) (*ActionArtifact, error)
- func GetArtifactsByRunAttemptAndName(ctx context.Context, runID, runAttemptID int64, artifactName string) ([]*ActionArtifact, error)
- func ListNeedExpiredArtifacts(ctx context.Context) ([]*ActionArtifact, error)
- func ListPendingDeleteArtifacts(ctx context.Context, limit int) ([]*ActionArtifact, error)
- type ActionArtifactMeta
- type ActionJobList
- func GetAllRunJobsByRepoAndRunID(ctx context.Context, repoID, runID int64) (ActionJobList, error)
- func GetDirectChildJobsByParent(ctx context.Context, parentJob *ActionRunJob) (ActionJobList, error)
- func GetLatestAttemptJobsByRepoAndRunID(ctx context.Context, repoID, runID int64) (ActionJobList, error)
- func GetRunJobsByRunAndAttemptID(ctx context.Context, runID, runAttemptID int64) (ActionJobList, error)
- func (jobs ActionJobList) GetRunIDs() []int64
- func (jobs ActionJobList) LoadAttributes(ctx context.Context, withRepo bool) error
- func (jobs ActionJobList) LoadRepos(ctx context.Context) error
- func (jobs ActionJobList) LoadRuns(ctx context.Context, withRepo bool) error
- func (jobs ActionJobList) SortMatrixGroupsByName()
- type ActionRun
- func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error)
- func GetRunByRepoAndID(ctx context.Context, repoID, runID int64) (*ActionRun, error)
- func GetRunByRepoAndIndex(ctx context.Context, repoID, runIndex 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) GetEffectiveConcurrency(ctx context.Context) (string, bool, error)
- func (run *ActionRun) GetLatestAttempt(ctx context.Context) (*ActionRunAttempt, bool, error)
- 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(ctxOpt ...context.Context) 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) LoadTriggerUser(ctx context.Context) (err error)
- func (run *ActionRun) PrettyRef() string
- func (run *ActionRun) RefLink() string
- func (run *ActionRun) RefTooltip() string
- func (run *ActionRun) WorkflowLink() string
- type ActionRunAttempt
- func FindConcurrentRunAttempts(ctx context.Context, repoID int64, concurrencyGroup string, statuses []Status) ([]*ActionRunAttempt, error)
- func GetRunAttemptByRepoAndID(ctx context.Context, repoID, attemptID int64) (*ActionRunAttempt, error)
- func GetRunAttemptByRunIDAndAttemptNum(ctx context.Context, runID, attemptNum int64) (*ActionRunAttempt, error)
- type ActionRunAttemptJobIDIndex
- type ActionRunAttemptList
- 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, attempt *ActionRunAttempt) ([]*ActionRunJob, error)
- func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository) ([]*ActionRunJob, error)
- func CollectAllDescendantJobs(parent *ActionRunJob, allJobs []*ActionRunJob) []*ActionRunJob
- func GetRunJobByAttemptJobID(ctx context.Context, runID, attemptID, attemptJobID int64) (*ActionRunJob, error)
- func GetRunJobByRepoAndID(ctx context.Context, repoID, jobID int64) (*ActionRunJob, error)
- func GetRunJobByRunAndID(ctx context.Context, runID, jobID int64) (*ActionRunJob, error)
- func (job *ActionRunJob) Duration() time.Duration
- func (job *ActionRunJob) EffectiveTaskID() int64
- func (job *ActionRunJob) LoadAttributes(ctx context.Context) error
- func (job *ActionRunJob) LoadRepo(ctx context.Context) error
- func (job *ActionRunJob) LoadRun(ctx context.Context) error
- func (job *ActionRunJob) ParseJob() (*jobparser.Job, error)
- type ActionRunJobSummary
- type ActionRunner
- func (r *ActionRunner) BelongsToOwnerName() string
- func (r *ActionRunner) BelongsToOwnerType() types.OwnerType
- func (r *ActionRunner) CanMatchLabels(jobRunsOn []string) bool
- func (r *ActionRunner) EditableInContext(ownerID, repoID int64) bool
- func (r *ActionRunner) GenerateAndFillToken()
- func (r *ActionRunner) IsOnline() bool
- func (r *ActionRunner) LoadAttributes(ctx context.Context) error
- 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 ActionScopedWorkflowSource
- func GetEffectiveScopedWorkflowSources(ctx context.Context, repoOwnerID int64) ([]*ActionScopedWorkflowSource, error)
- func GetScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) (*ActionScopedWorkflowSource, error)
- func GetScopedWorkflowSourcesByOwner(ctx context.Context, ownerID int64) ([]*ActionScopedWorkflowSource, error)
- 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 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) GenerateAndFillToken()
- 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 FindArtifactsOptions
- type FindRunJobOptions
- type FindRunOptions
- type FindRunnerOptions
- type FindScheduleOptions
- type FindScopedWorkflowSourceOpts
- type FindSpecOptions
- type FindTaskOptions
- type FindVariablesOpts
- type LogIndexes
- type OwnerActionsConfig
- func (cfg *OwnerActionsConfig) ClampPermissions(perms repo_model.ActionsTokenPermissions) repo_model.ActionsTokenPermissions
- func (cfg *OwnerActionsConfig) FromDB(bytes []byte) error
- func (cfg *OwnerActionsConfig) GetDefaultTokenPermissions() repo_model.ActionsTokenPermissions
- func (cfg *OwnerActionsConfig) GetMaxTokenPermissions() repo_model.ActionsTokenPermissions
- type RunList
- type RunnerList
- type ScheduleList
- type ScopedWorkflowConfig
- 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) IsCancelling() 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 ( ContentEncodingV3Gzip = "gzip" ContentTypeZip = "application/zip" )
const ( // JobSummaryCapability is the runner-declare capability string for job summaries. JobSummaryCapability = "job-summary" // JobSummaryContentTypeMarkdown is the only accepted content type for job summaries. JobSummaryContentTypeMarkdown = "text/markdown" // MaxJobSummarySize is the maximum accepted per-step summary payload size in bytes. MaxJobSummarySize = 1024 * 1024 // 1 MiB // MaxJobSummaryAggregateSize is the maximum aggregate size of all step summaries within // a single job attempt. Matches GitHub's documented per-job summary cap of 1 MiB. MaxJobSummaryAggregateSize = 1024 * 1024 // 1 MiB )
const ( RunnerOfflineTime = time.Minute RunnerIdleTime = 10 * time.Second // RunnerHeartbeatInterval is how often last_online is persisted on poll. // Must stay well below RunnerOfflineTime so runners don't flap to offline. RunnerHeartbeatInterval = 30 * time.Second // RunnerActiveInterval is how often last_active is persisted while a runner // streams task updates and logs. Must stay well below RunnerIdleTime so a // busy runner keeps showing ACTIVE without a DB write on every RPC. RunnerActiveInterval = 5 * time.Second )
const ( VariableDataMaxLength = 65536 VariableDescriptionMaxLength = 4096 )
const MaxJobNumPerRun = 256
MaxJobNumPerRun is the maximum number of jobs in a single run. https://docs.github.com/en/actions/reference/limits#existing-system-limits TODO: check this limit when creating jobs
Variables ¶
var ErrJobSummaryAggregateExceeded = util.NewInvalidArgumentErrorf("job summary aggregate size exceeded")
ErrJobSummaryAggregateExceeded is returned when a step summary upload would push the aggregate size of summaries for a single job attempt over MaxJobSummaryAggregateSize.
var JobOrderByMap = map[string]map[string]db.SearchOrderBy{
"asc": {"id": "`action_run_job`.id ASC"},
"desc": {"id": "`action_run_job`.id DESC"},
}
Functions ¶
func AddScopedWorkflowSource ¶
AddScopedWorkflowSource registers repoID as a source for ownerID (no-op if already registered).
func ComputeTaskTokenPermissions ¶
func ComputeTaskTokenPermissions(ctx context.Context, task *ActionTask, targetRepo *repo_model.Repository) (ret repo_model.ActionsTokenPermissions, err error)
ComputeTaskTokenPermissions computes the effective permissions for a job token against the target repository. It uses the job's stored permissions (if any), then applies org/repo clamps and fork/cross-repo restrictions. Note: target repository access policy checks are enforced in GetActionsUserRepoPermission; this function only computes the job token's effective permission ceiling.
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 DeleteActionRunJobSummary ¶
func DeleteActionRunJobSummary(ctx context.Context, repoID, runID, runAttemptID, jobID, stepIndex int64) error
DeleteActionRunJobSummary removes the stored summary for a specific step. Used when a runner PUTs an empty body to clear a previously-uploaded step summary.
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 GetConcurrentRunAttemptsAndJobs ¶
func GetConcurrentRunAttemptsAndJobs(ctx context.Context, repoID int64, concurrencyGroup string, status []Status) ([]*ActionRunAttempt, []*ActionRunJob, error)
GetConcurrentRunAttemptsAndJobs returns run attempts and jobs in the same concurrency group by statuses.
func GetNextAttemptJobID ¶
GetNextAttemptJobID atomically allocates the next AttemptJobID for a job in the given run. AttemptJobIDs are unique within a single attempt and stable across attempts for the same logical job
func GetPriorAttemptChildrenByParent ¶
func GetPriorAttemptChildrenByParent(ctx context.Context, runID, currentAttemptID, parentAttemptJobID int64) (map[string]map[string]*ActionRunJob, error)
GetPriorAttemptChildrenByParent returns the children of the most recent prior attempt where the parent (identified by parentAttemptJobID) actually had children, indexed by child JobID then child Name. Returns (nil, nil) when no such attempt exists. The (JobID, Name) key disambiguates both reusable-workflow subtrees and matrix-expanded instances (whose Name carries the matrix suffix).
func GetRepoRunWorkflowIDs ¶
GetRepoRunWorkflowIDs returns all distinct WorkflowIDs that have at least one repo-level ActionRun in the given repo.
func GetRunBranches ¶
GetRunBranches returns branch names for the run-list "Branch" filter. Sourced from the `branch` table (indexed by repo_id) rather than DISTINCT-ing `action_run.ref`, which is wildcard-matched and slow on large repos; as a side effect the list reflects existing branches, not only ones that produced a run.
func GetRunWorkflowIDs ¶
GetRunWorkflowIDs returns all distinct WorkflowIDs that have at least one ActionRun in the given repo.
func GetSchedulesMapByIDs ¶
GetSchedulesMapByIDs returns the schedules by given id slice.
func GetTasksVersionByScope ¶
func GetVariablesOfRun ¶
func IncreaseTaskVersion ¶
func InsertTaskOutputIfNotExist ¶
InsertTaskOutputIfNotExist inserts a new task output if it does not exist.
func IsScopedWorkflowOptedOut ¶
func IsScopedWorkflowOptedOut(ctx context.Context, cfg *repo_model.ActionsConfig, consumerOwnerID, sourceRepoID int64, workflowID string) (bool, error)
IsScopedWorkflowOptedOutloads the consumer's effective sources then calls ScopedWorkflowOptedOut
func IsScopedWorkflowRequired ¶
func IsScopedWorkflowRequired(ctx context.Context, consumerOwnerID, sourceRepoID int64, workflowID string) (bool, error)
IsScopedWorkflowRequired reports whether workflowID from sourceRepoID is required for a repo owned by consumerOwnerID.
func IsScopedWorkflowSourceEffective ¶
func IsScopedWorkflowSourceEffective(ctx context.Context, repoOwnerID, sourceRepoID int64) (bool, error)
IsScopedWorkflowSourceEffective reports whether sourceRepoID is a scoped-workflow source effective for a repo owned by repoOwnerID.
func IsWorkflowRequiredInSources ¶
func IsWorkflowRequiredInSources(sources []*ActionScopedWorkflowSource, sourceRepoID int64, workflowID string) bool
IsWorkflowRequiredInSources reports whether workflowID from sourceRepoID is required by any of the given sources.
func RefreshReusableCallerStatus ¶
func RefreshReusableCallerStatus(ctx context.Context, caller *ActionRunJob) error
RefreshReusableCallerStatus recomputes a reusable workflow caller's Status, Started and Stopped from its current direct children and persists the change. No-op if caller is not a reusable caller.
Concurrency: two sibling children finishing at roughly the same time can each invoke this for the same parent caller. No row-level lock is taken because AggregateJobStatus is a pure function of the children's statuses (order-independent), so racing callers arrive at the same Status.
func ReleaseTaskForRunner ¶
func ReleaseTaskForRunner(ctx context.Context, task *ActionTask) error
ReleaseTaskForRunner reverts a freshly-claimed but undelivered task: it deletes the task together with its steps and returns the job to the waiting queue. It is used when assembling the runner response fails after the job was already claimed, so the job is not stranded in running state with no runner ever executing it.
func RemoveScopedWorkflowSource ¶
RemoveScopedWorkflowSource removes the (owner, repo) source registration.
func RunnerCapabilities ¶
func RunnerCapabilities() string
RunnerCapabilities returns the value advertised in the X-Gitea-Actions-Capabilities header. When more capabilities are added, return them comma-separated so runners can split on ", ".
func ScopedStatusContextPrefix ¶
ScopedStatusContextPrefix returns the source-repo prefix that makes a scoped run's commit-status context distinct from same-named workflows.
func ScopedWorkflowOptedOut ¶
func ScopedWorkflowOptedOut(cfg *repo_model.ActionsConfig, sources []*ActionScopedWorkflowSource, sourceRepoID int64, workflowID string) bool
ScopedWorkflowOptedOut reports whether a consumer's opt-out of (sourceRepoID, workflowID) is in effect.
func SetArtifactDeleted ¶
SetArtifactDeleted sets an artifact to deleted
func SetArtifactExpired ¶
SetArtifactExpired sets an artifact to expired
func SetArtifactNeedDeleteByID ¶
SetArtifactNeedDeleteByID sets an artifact to need-delete by ID, cron job will delete it.
func SetArtifactNeedDeleteByRunAttempt ¶
func SetArtifactNeedDeleteByRunAttempt(ctx context.Context, runID, runAttemptID int64, name string) error
SetArtifactNeedDeleteByRunAttempt sets an artifact to need-delete in a run attempt, cron job will delete it. runAttemptID may be 0 for legacy artifacts created before ActionRunAttempt existed.
func SetOwnerActionsConfig ¶
func SetOwnerActionsConfig(ctx context.Context, userID int64, cfg OwnerActionsConfig) error
SetOwnerActionsConfig saves the OwnerActionsConfig for a user or organization to user settings
func SetRunnerDisabled ¶
func SetRunnerDisabled(ctx context.Context, runner *ActionRunner, isDisabled bool) error
func SetScopedWorkflowSourceConfigs ¶
func SetScopedWorkflowSourceConfigs(ctx context.Context, ownerID, repoID int64, configs map[string]*ScopedWorkflowConfig) error
SetScopedWorkflowSourceConfigs replaces the per-workflow merge-gate configs (workflow ID -> config).
func ShouldPersistLastActive ¶
ShouldPersistLastActive reports whether last_active is stale enough to be worth writing back. Avoids a DB write on every UpdateTask/UpdateLog RPC while a runner is actively streaming logs.
func ShouldPersistLastOnline ¶
ShouldPersistLastOnline reports whether last_online is stale enough to be worth writing back. Avoids a DB write on every runner poll.
func UpdateArtifactByID ¶
func UpdateArtifactByID(ctx context.Context, id int64, art *ActionArtifact) error
UpdateArtifactByID updates an artifact by id
func UpdateRepoRunsNumbers ¶
UpdateRepoRunsNumbers updates the number of runs and closed runs of a repository. Callers MUST invoke this from outside any transaction that has X-locked action_run rows for the same repo, otherwise, transaction deadlock
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 UpdateRunAttempt ¶
func UpdateRunAttempt(ctx context.Context, attempt *ActionRunAttempt, cols ...string) error
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 UpdateTask ¶
func UpdateTask(ctx context.Context, task *ActionTask, cols ...string) error
func UpdateVariableCols ¶
Types ¶
type ActionArtifact ¶
type ActionArtifact struct {
ID int64 `xorm:"pk autoincr"`
RunID int64 `xorm:"index unique(runid_attempt_name_path)"` // The run id of the artifact
RunAttemptID int64 `xorm:"index unique(runid_attempt_name_path) NOT NULL DEFAULT 0"`
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
// The content encoding or content type of the artifact
// * empty or null: legacy (v3) uncompressed content
// * magic string "gzip" (ContentEncodingV3Gzip): v3 gzip compressed content
// * requires gzip decoding before storing in a zip for download
// * requires gzip content-encoding header when downloaded single files within a workflow
// * mime type for "Content-Type":
// * "application/zip" (ContentTypeZip), seems to be an abuse, fortunately there is no conflict, and it won't cause problems?
// * "application/pdf", "text/html", etc.: real content type of the artifact
ContentEncodingOrType string `xorm:"content_encoding"`
ArtifactPath string `xorm:"index unique(runid_attempt_name_path)"` // The path to the artifact when runner uploads it
ArtifactName string `xorm:"index unique(runid_attempt_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 GetArtifactsByRunAttemptAndName ¶
func GetArtifactsByRunAttemptAndName(ctx context.Context, runID, runAttemptID int64, artifactName string) ([]*ActionArtifact, error)
GetArtifactsByRunAttemptAndName returns all artifacts with the given name in the specified run attempt. This supports both attempt-scoped data and legacy artifacts with run_attempt_id=0.
func ListNeedExpiredArtifacts ¶
func ListNeedExpiredArtifacts(ctx context.Context) ([]*ActionArtifact, error)
ListNeedExpiredArtifacts returns all need expired artifacts but not deleted
func ListPendingDeleteArtifacts ¶
func ListPendingDeleteArtifacts(ctx context.Context, limit int) ([]*ActionArtifact, error)
ListPendingDeleteArtifacts returns all artifacts in pending-delete status. limit is the max number of artifacts to return.
type ActionArtifactMeta ¶
type ActionArtifactMeta struct {
ArtifactName string
FileSize int64
Status ArtifactStatus
ExpiredUnix timeutil.TimeStamp
}
ActionArtifactMeta is the meta-data of an artifact
func ListUploadedArtifactsMetaByRunAttempt ¶
func ListUploadedArtifactsMetaByRunAttempt(ctx context.Context, repoID, runID, runAttemptID int64) ([]*ActionArtifactMeta, error)
ListUploadedArtifactsMetaByRunAttempt returns uploaded artifacts meta scoped to a specific run and attempt. Pass runAttemptID=0 to target legacy artifacts (pre-v331) belonging to the run.
type ActionJobList ¶
type ActionJobList []*ActionRunJob
func GetAllRunJobsByRepoAndRunID ¶
func GetAllRunJobsByRepoAndRunID(ctx context.Context, repoID, runID int64) (ActionJobList, error)
GetAllRunJobsByRepoAndRunID returns all jobs for a run across all attempts.
func GetDirectChildJobsByParent ¶
func GetDirectChildJobsByParent(ctx context.Context, parentJob *ActionRunJob) (ActionJobList, error)
GetDirectChildJobsByParent returns the direct child jobs of a parent job (e.g. a reusable workflow caller).
func GetLatestAttemptJobsByRepoAndRunID ¶
func GetLatestAttemptJobsByRepoAndRunID(ctx context.Context, repoID, runID int64) (ActionJobList, error)
GetLatestAttemptJobsByRepoAndRunID returns the jobs of the latest attempt for a run. It prefers the latest attempt when one exists, and falls back to legacy jobs with run_attempt_id=0 for runs created before ActionRunAttempt existed.
func GetRunJobsByRunAndAttemptID ¶
func GetRunJobsByRunAndAttemptID(ctx context.Context, runID, runAttemptID int64) (ActionJobList, error)
GetRunJobsByRunAndAttemptID returns jobs for a run within a specific attempt. runAttemptID may be 0 to address legacy jobs that were created before ActionRunAttempt existed and therefore have no attempt association.
func (ActionJobList) GetRunIDs ¶
func (jobs ActionJobList) GetRunIDs() []int64
func (ActionJobList) LoadAttributes ¶
func (jobs ActionJobList) LoadAttributes(ctx context.Context, withRepo bool) error
func (ActionJobList) LoadRuns ¶
func (jobs ActionJobList) LoadRuns(ctx context.Context, withRepo bool) error
func (ActionJobList) SortMatrixGroupsByName ¶
func (jobs ActionJobList) SortMatrixGroupsByName()
SortMatrixGroupsByName natural-sorts each contiguous run of jobs that share a JobID so matrix expansions (e.g. "test (1)", "test (2)", "test (10)") appear in human order. Input is expected to be in DB id order so JobID groups are contiguous; cross-group order is preserved.
type ActionRun ¶
type ActionRun struct {
ID int64
Title string
RepoID int64 `xorm:"unique(repo_index)"`
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
// WorkflowRepoID/WorkflowCommitSHA record the (repo, commit) the run's workflow file content came from.
// Always filled (repo-level run = the repo itself; scoped run = the source repo).
WorkflowRepoID int64 `xorm:"NOT NULL DEFAULT 0"`
WorkflowCommitSHA string `xorm:"VARCHAR(64) NOT NULL DEFAULT ''"`
IsScopedRun bool `xorm:"NOT NULL DEFAULT false"` // IsScopedRun explicitly classifies scoped runs.
// Started and Stopped are identical to the latest attempt after ActionRunAttempt was introduced.
// When a rerun creates a new latest attempt, they are reset until the new attempt starts and stops.
Started timeutil.TimeStamp
Stopped timeutil.TimeStamp
// PreviousDuration is kept only for legacy runs created before ActionRunAttempt existed.
// New runs and reruns no longer update this field and use attempt-scoped durations instead.
PreviousDuration time.Duration
LatestAttemptID int64 `xorm:"index NOT NULL DEFAULT 0"`
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionRun represents a run of a workflow file
func GetRunByRepoAndID ¶
func GetRunByRepoAndIndex ¶
func GetWorkflowLatestRun ¶
func (*ActionRun) GetEffectiveConcurrency ¶
func (*ActionRun) GetLatestAttempt ¶
GetLatestAttempt returns
- the latest attempt of the run
- (nil, false, nil) for legacy runs that have no attempt records
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) IsSchedule ¶
func (*ActionRun) LoadAttributes ¶
LoadAttributes load Repo TriggerUser if not loaded
func (*ActionRun) LoadTriggerUser ¶
func (*ActionRun) RefTooltip ¶
RefTooltip return a tooltip of run's ref. For pull request, it's the title of the PR, otherwise it's the ShortName.
func (*ActionRun) WorkflowLink ¶
type ActionRunAttempt ¶
type ActionRunAttempt struct {
ID int64
RepoID int64 `xorm:"index(repo_concurrency_status)"`
RunID int64 `xorm:"UNIQUE(run_attempt)"`
Run *ActionRun `xorm:"-"`
Attempt int64 `xorm:"UNIQUE(run_attempt)"`
TriggerUserID int64
TriggerUser *user_model.User `xorm:"-"`
ConcurrencyGroup string `xorm:"index(repo_concurrency_status) NOT NULL DEFAULT ''"`
ConcurrencyCancel bool `xorm:"NOT NULL DEFAULT FALSE"`
Status Status `xorm:"index(repo_concurrency_status)"`
Started timeutil.TimeStamp
Stopped timeutil.TimeStamp
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
ActionRunAttempt represents a single execution attempt of an ActionRun.
func FindConcurrentRunAttempts ¶
func FindConcurrentRunAttempts(ctx context.Context, repoID int64, concurrencyGroup string, statuses []Status) ([]*ActionRunAttempt, error)
FindConcurrentRunAttempts returns attempts in the given concurrency group and status set. Results are unordered; callers must not depend on any particular row order.
func GetRunAttemptByRepoAndID ¶
func GetRunAttemptByRepoAndID(ctx context.Context, repoID, attemptID int64) (*ActionRunAttempt, error)
func GetRunAttemptByRunIDAndAttemptNum ¶
func GetRunAttemptByRunIDAndAttemptNum(ctx context.Context, runID, attemptNum int64) (*ActionRunAttempt, error)
func (*ActionRunAttempt) Duration ¶
func (attempt *ActionRunAttempt) Duration() time.Duration
func (*ActionRunAttempt) LoadAttributes ¶
func (attempt *ActionRunAttempt) LoadAttributes(ctx context.Context) (err error)
func (*ActionRunAttempt) TableName ¶
func (*ActionRunAttempt) TableName() string
type ActionRunAttemptJobIDIndex ¶
type ActionRunAttemptJobIDIndex db.ResourceIndex
ActionRunAttemptJobIDIndex backs the run-wide AttemptJobID counter, keyed by ActionRun.ID. Use GetNextAttemptJobID to allocate the next ID for a run.
type ActionRunAttemptList ¶
type ActionRunAttemptList []*ActionRunAttempt
func ListRunAttemptsByRunID ¶
func ListRunAttemptsByRunID(ctx context.Context, runID int64) (ActionRunAttemptList, error)
ListRunAttemptsByRunID returns all attempts of a run, ordered by attempt number DESC (newest first).
func (ActionRunAttemptList) GetUserIDs ¶
func (attempts ActionRunAttemptList) GetUserIDs() []int64
GetUserIDs returns a slice of user's id
func (ActionRunAttemptList) LoadTriggerUser ¶
func (attempts ActionRunAttemptList) LoadTriggerUser(ctx context.Context) error
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)"`
// for legacy jobs, this counts how many times the job has run;
// otherwise it matches the Attempt of the ActionRunAttempt identified by job.RunAttemptID
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 task created by this job in its own attempt
SourceTaskID int64 `xorm:"NOT NULL DEFAULT 0"` // SourceTaskID points to a historical task when this job reuses an earlier attempt's result.
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
// TokenPermissions stores the explicit permissions from workflow/job YAML (no org/repo clamps applied).
// Org/repo clamps are enforced when the token is used at runtime.
// It is JSON-encoded repo_model.ActionsTokenPermissions and may be empty if not specified.
TokenPermissions *repo_model.ActionsTokenPermissions `xorm:"JSON TEXT"`
// RunAttemptID identifies the ActionRunAttempt this job belongs to.
// A value of 0 indicates a legacy job created before ActionRunAttempt existed.
RunAttemptID int64 `xorm:"index NOT NULL DEFAULT 0"`
// AttemptJobID is unique within a single attempt.
// For jobs created after ActionRunAttempt was introduced, the same logical job is expected to keep the same AttemptJobID across attempts.
// A value of 0 indicates a legacy job created before ActionRunAttempt existed.
AttemptJobID int64 `xorm:"index NOT NULL DEFAULT 0"`
// WorkflowSourceRepoID + WorkflowSourceCommitSHA record the (repo, commit) this job's containing workflow file came from.
WorkflowSourceRepoID int64 `xorm:"NOT NULL DEFAULT 0"`
WorkflowSourceCommitSHA string `xorm:"VARCHAR(64) NOT NULL DEFAULT ''"`
// IsReusableCaller marks this job as a reusable workflow caller.
// Caller jobs do not run on a runner; their status is derived from their child jobs.
IsReusableCaller bool `xorm:"index NOT NULL DEFAULT FALSE"`
// IsExpanded reports whether this job's lazy expansion (children-row insertion) is complete.
// For a reusable workflow caller, true means children rows exist and CallPayload is populated.
IsExpanded bool `xorm:"NOT NULL DEFAULT FALSE"`
// CallUses stores the raw "uses:" string of a reusable workflow caller job.
// Only set when IsReusableCaller is true.
CallUses string `xorm:"VARCHAR(512) NOT NULL DEFAULT ''"`
// ReusableWorkflowContent is the content of the reusable workflow specified by "uses:".
// Only set when IsReusableCaller is true.
ReusableWorkflowContent []byte `xorm:"LONGBLOB"`
// CallSecrets encodes the reusable workflow caller's "secrets:" section:
// - "" : no "secrets:" section (children only see auto-generated tokens).
// - "inherit" : the caller wrote "secrets: inherit".
// - JSON object : explicit mapping {alias: source_name}; names only, no values.
// Only set when IsReusableCaller is true.
CallSecrets string `xorm:"LONGTEXT"`
// CallPayload is the JSON-encoded WorkflowCallPayload exposed to children as gitea.event.
// Populated atomically with IsExpanded at the end of expandReusableWorkflowCaller.
// Only set when IsReusableCaller is true.
CallPayload string `xorm:"LONGTEXT"`
// ParentJobID scopes `Needs` resolution: name lookups happen only among rows sharing the same ParentJobID. 0 for top-level rows.
ParentJobID int64 `xorm:"index NOT NULL DEFAULT 0"`
// ContinueOnError mirrors the job-level continue-on-error field from the workflow YAML.
// When true, a failure of this job does not fail the overall workflow run.
ContinueOnError bool `xorm:"NOT NULL DEFAULT FALSE"`
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, attempt *ActionRunAttempt) ([]*ActionRunJob, error)
func CleanRepoScheduleTasks ¶
func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository) ([]*ActionRunJob, error)
func CollectAllDescendantJobs ¶
func CollectAllDescendantJobs(parent *ActionRunJob, allJobs []*ActionRunJob) []*ActionRunJob
CollectAllDescendantJobs returns every job in `allJobs` that lives under parent's subtree (recursively), excluding `parent` itself
func GetRunJobByAttemptJobID ¶
func GetRunJobByAttemptJobID(ctx context.Context, runID, attemptID, attemptJobID int64) (*ActionRunJob, error)
func GetRunJobByRepoAndID ¶
func GetRunJobByRepoAndID(ctx context.Context, repoID, jobID int64) (*ActionRunJob, error)
func GetRunJobByRunAndID ¶
func GetRunJobByRunAndID(ctx context.Context, runID, jobID int64) (*ActionRunJob, error)
func (*ActionRunJob) Duration ¶
func (job *ActionRunJob) Duration() time.Duration
func (*ActionRunJob) EffectiveTaskID ¶
func (job *ActionRunJob) EffectiveTaskID() int64
func (*ActionRunJob) LoadAttributes ¶
func (job *ActionRunJob) LoadAttributes(ctx context.Context) error
LoadAttributes load Run if not loaded
type ActionRunJobSummary ¶
type ActionRunJobSummary struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"UNIQUE(summary_key)"`
RunID int64 `xorm:"UNIQUE(summary_key)"`
RunAttemptID int64 `xorm:"UNIQUE(summary_key) NOT NULL DEFAULT 0"`
JobID int64 `xorm:"UNIQUE(summary_key)"`
StepIndex int64 `xorm:"UNIQUE(summary_key)"`
Content string `xorm:"LONGTEXT"`
ContentType string `xorm:"VARCHAR(255) NOT NULL DEFAULT 'text/markdown'"`
// ContentSize is the byte length of Content. Stored explicitly because LENGTH()
// counts characters (not bytes) on PostgreSQL, SQLite and MSSQL, which would let
// multibyte UTF-8 content bypass the aggregate cap.
ContentSize int64 `xorm:"NOT NULL DEFAULT 0"`
Created timeutil.TimeStamp `xorm:"created"`
Updated timeutil.TimeStamp `xorm:"updated"`
}
func GetActionRunJobSummary ¶
func GetActionRunJobSummary(ctx context.Context, repoID, runID, runAttemptID, jobID, stepIndex int64) (*ActionRunJobSummary, error)
func ListActionRunJobSummaries ¶
func ListActionRunJobSummaries(ctx context.Context, repoID, runID, runAttemptID, jobID int64) ([]*ActionRunJobSummary, error)
ListActionRunJobSummaries lists the stored summaries for a run attempt, ordered by job then step. A positive jobID scopes the lookup to that single job, used by the job view to avoid rendering every job's summary on each poll; jobID<=0 returns all jobs in the attempt.
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"`
// Store if this runner is disabled and should not pick up new jobs
IsDisabled bool `xorm:"is_disabled NOT NULL DEFAULT false"`
// Store if this runner supports the StatusCancelling flow
HasCancellingSupport bool `xorm:"has_cancelling_support NOT NULL DEFAULT false"`
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 (*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) 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) GenerateAndFillToken ¶
func (r *ActionRunner) GenerateAndFillToken()
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) 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
func NewRunnerToken ¶
func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error)
func NewRunnerTokenWithValue ¶
func NewRunnerTokenWithValue(ctx context.Context, ownerID, repoID int64, token string) (*ActionRunnerToken, error)
NewRunnerTokenWithValue creates a new active runner token and invalidate all old tokens ownerID will be ignored and treated as 0 if repoID is non-zero.
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
type ActionScopedWorkflowSource ¶
type ActionScopedWorkflowSource struct {
ID int64 `xorm:"pk autoincr"`
// OwnerID is the scope the source applies to: a user/org ID (applies to that owner's repos), or 0 for instance-level (applies to every repo).
OwnerID int64 `xorm:"UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
// SourceRepoID is the source repository providing the workflow files; always non-zero.
SourceRepoID int64 `xorm:"INDEX UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
// WorkflowConfigs maps a workflow ID (entry name) to its merge-gate config.
WorkflowConfigs map[string]*ScopedWorkflowConfig `xorm:"JSON TEXT 'workflow_configs'"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
}
ActionScopedWorkflowSource registers a repository as a source of scoped workflows, either for an owner (user/org) or for the whole instance.
func GetEffectiveScopedWorkflowSources ¶
func GetEffectiveScopedWorkflowSources(ctx context.Context, repoOwnerID int64) ([]*ActionScopedWorkflowSource, error)
GetEffectiveScopedWorkflowSources returns the scoped-workflow sources effective for a repo owned by repoOwnerID: the owner's own sources plus instance-level (owner_id=0) sources.
func GetScopedWorkflowSource ¶
func GetScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) (*ActionScopedWorkflowSource, error)
GetScopedWorkflowSource returns the (owner, repo) source registration or a NotExist error.
func GetScopedWorkflowSourcesByOwner ¶
func GetScopedWorkflowSourcesByOwner(ctx context.Context, ownerID int64) ([]*ActionScopedWorkflowSource, error)
GetScopedWorkflowSourcesByOwner returns the sources an owner (user/org, or 0 for instance) registered.
func (*ActionScopedWorkflowSource) IsWorkflowRequired ¶
func (s *ActionScopedWorkflowSource) IsWorkflowRequired(workflowID string) bool
IsWorkflowRequired reports whether the given workflow ID (entry name) is marked required in this source.
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 finds a waiting job that matches the runner's labels and atomically claims it. It iterates through all matching jobs so that a concurrent claim by another runner (which would lose the optimistic lock on job #1) does not leave the remaining jobs permanently unassigned.
func FindOldTasksToExpire ¶
func GetRunningTaskByToken ¶
func GetRunningTaskByToken(ctx context.Context, token string) (*ActionTask, error)
func GetTaskByID ¶
func GetTaskByID(ctx context.Context, id int64) (*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) GenerateAndFillToken ¶
func (task *ActionTask) GenerateAndFillToken()
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
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.
func FindTaskOutputByTaskID ¶
func FindTaskOutputByTaskID(ctx context.Context, taskID int64) ([]*ActionTaskOutput, error)
FindTaskOutputByTaskID returns the outputs of the task.
type ActionTaskStep ¶
type ActionTaskStep struct {
ID int64
Name string `xorm:"VARCHAR(255)"` // the step name, for display purpose only, it will be truncated if it is too long
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)
func InsertVariable ¶
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 FindArtifactsOptions ¶
type FindArtifactsOptions struct {
db.ListOptions
RepoID int64
RunID int64
RunAttemptID optional.Option[int64] // use optional to allow filtering by zero (legacy artifacts have run_attempt_id=0)
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
RunAttemptID optional.Option[int64] // use optional to allow filtering by zero (legacy jobs have run_attempt_id=0)
RepoID int64
OwnerID int64
CommitSHA string
Statuses []Status
UpdatedBefore timeutil.TimeStamp
ConcurrencyGroup string
OrderBy db.SearchOrderBy
// AccessibleRepoIDsSubQuery, when non-nil, restricts results to the repo IDs selected by the
// subquery (the caller's accessible repos). A nil value means no restriction. Using a subquery
// instead of a materialized ID slice avoids exceeding DB parameter limits for large owners.
AccessibleRepoIDsSubQuery *builder.Builder
}
func (FindRunJobOptions) ToConds ¶
func (opts FindRunJobOptions) ToConds() builder.Cond
func (FindRunJobOptions) ToJoins ¶
func (opts FindRunJobOptions) ToJoins() []db.JoinFunc
func (FindRunJobOptions) ToOrders ¶
func (opts FindRunJobOptions) ToOrders() string
type FindRunOptions ¶
type FindRunOptions struct {
db.ListOptions
RepoID int64
OwnerID int64
WorkflowID string
WorkflowRepoID int64 // source-aware filter: the repo a run's workflow content came from (0 = any)
IsScopedRun optional.Option[bool] // is the run from a scoped workflow
Ref string // the commit/tag/… that caused this workflow
TriggerUserID int64
TriggerEvent webhook_module.HookEventType
Status []Status
ConcurrencyGroup string
CommitSHA string
// AccessibleRepoIDsSubQuery, when non-nil, restricts results to the repo IDs selected by the
// subquery (the caller's accessible repos). A nil value means no restriction. Using a subquery
// instead of a materialized ID slice avoids exceeding DB parameter limits for large owners.
AccessibleRepoIDsSubQuery *builder.Builder
}
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]
IsDisabled 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 FindScopedWorkflowSourceOpts ¶
type FindScopedWorkflowSourceOpts struct {
db.ListOptions
OwnerIDs []int64
SourceRepoID int64
}
func (FindScopedWorkflowSourceOpts) ToConds ¶
func (opts FindScopedWorkflowSourceOpts) ToConds() builder.Cond
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 OwnerActionsConfig ¶
type OwnerActionsConfig struct {
// TokenPermissionMode defines the default permission mode (permissive, restricted)
TokenPermissionMode repo_model.ActionsTokenPermissionMode `json:"token_permission_mode,omitempty"`
// MaxTokenPermissions defines the absolute maximum permissions any token can have in this context.
MaxTokenPermissions *repo_model.ActionsTokenPermissions `json:"max_token_permissions,omitempty"`
// AllowedCrossRepoIDs is a list of specific repo IDs that can be accessed cross-repo
AllowedCrossRepoIDs []int64 `json:"allowed_cross_repo_ids,omitempty"`
}
OwnerActionsConfig defines the Actions configuration for a user or organization
func GetOwnerActionsConfig ¶
func GetOwnerActionsConfig(ctx context.Context, userID int64) (ret OwnerActionsConfig, err error)
GetOwnerActionsConfig loads the OwnerActionsConfig for a user or organization from user settings It returns a default config if no setting is found
func (*OwnerActionsConfig) ClampPermissions ¶
func (cfg *OwnerActionsConfig) ClampPermissions(perms repo_model.ActionsTokenPermissions) repo_model.ActionsTokenPermissions
ClampPermissions ensures that the given permissions don't exceed the maximum
func (*OwnerActionsConfig) FromDB ¶
func (cfg *OwnerActionsConfig) FromDB(bytes []byte) error
func (*OwnerActionsConfig) GetDefaultTokenPermissions ¶
func (cfg *OwnerActionsConfig) GetDefaultTokenPermissions() repo_model.ActionsTokenPermissions
GetDefaultTokenPermissions returns the default token permissions by its TokenPermissionMode.
func (*OwnerActionsConfig) GetMaxTokenPermissions ¶
func (cfg *OwnerActionsConfig) GetMaxTokenPermissions() repo_model.ActionsTokenPermissions
GetMaxTokenPermissions returns the maximum allowed permissions
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
type ScheduleList ¶
type ScheduleList []*ActionSchedule
type ScopedWorkflowConfig ¶
type ScopedWorkflowConfig struct {
Required bool `json:"required"`
Patterns []string `json:"patterns"` // the status-check patterns that must be present and pass, only effective when Required is true
}
ScopedWorkflowConfig is one scoped workflow's config within a source registration.
type SpecList ¶
type SpecList []*ActionScheduleSpec
func (SpecList) GetRepoIDs ¶
func (SpecList) GetScheduleIDs ¶
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 StatusCancelling // 8, isn't a runnerv1.Result )
func AggregateJobStatus ¶
func AggregateJobStatus(jobs []*ActionRunJob) Status
func StatusFromResult ¶
func (Status) IsCancelled ¶
func (Status) IsCancelling ¶
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
- config.go
- run.go
- run_attempt.go
- run_attempt_list.go
- run_job.go
- run_job_list.go
- run_job_summary.go
- run_list.go
- runner.go
- runner_list.go
- runner_token.go
- schedule.go
- schedule_list.go
- schedule_spec.go
- schedule_spec_list.go
- scoped_workflow.go
- status.go
- task.go
- task_list.go
- task_output.go
- task_step.go
- tasks_version.go
- token_permissions.go
- utils.go
- variable.go