Documentation ¶
Overview ¶
Package jobs contains jobs run by a job manager.
Index ¶
- Constants
- Variables
- func Clone(ctx context.Context, projectID string, priority models.JobPriority) (string, error)
- func LoadAllCommits(ctx context.Context) []string
- func LoadAllSources(ctx context.Context) []string
- func LoadCommits(ctx context.Context, projectID string, priority models.JobPriority) (string, error)
- func LoadDirectorySource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)
- func LoadGitSource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)
- func LoadSource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)
- func Pull(ctx context.Context, projectID string, priority models.JobPriority) (string, error)
- func Run(ctx context.Context, taskID string, env []string, priority models.JobPriority) (string, error)
- func StartPeriodic(ctx context.Context, waitTime time.Duration, ...) error
Constants ¶
const ( LoadDirectorySourceJob = "Load Directory Source" LoadGitSourceJob = "Load Git Source" LoadCommitsJob = "Load Commits" CloneJob = "Clone" PullJob = "Pull" RunJob = "Run" )
Job names.
Variables ¶
var ( ErrDuplicate = errors.New("a job already exists") ErrCloned = errors.New("project is already cloned") ErrNotCloned = errors.New("project isn't cloned") )
Errors.
Functions ¶
func LoadAllCommits ¶
LoadAllCommits creates jobs to load the commits of every project. It doesn't return errors but will output a log message when errors happen.
func LoadAllSources ¶ added in v0.2.0
LoadAllSources creates jobs to load the workspaces of every source. It doesn't return errors but will output a log message when errors happen.
func LoadCommits ¶
func LoadCommits(ctx context.Context, projectID string, priority models.JobPriority) (string, error)
LoadCommits loads the commits of a project from a remote repo and updates the project.
func LoadDirectorySource ¶ added in v0.2.0
func LoadDirectorySource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)
LoadDirectorySource loads the workspaces of the source and updates it.
func LoadGitSource ¶ added in v0.2.0
func LoadGitSource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)
LoadGitSource loads the workspaces of the source and updates it.
func LoadSource ¶ added in v0.2.0
LoadSource loads the workspaces of the source and updates it.
func Run ¶
func Run(ctx context.Context, taskID string, env []string, priority models.JobPriority) (string, error)
Run runs a task.
func StartPeriodic ¶
func StartPeriodic( ctx context.Context, waitTime time.Duration, chain ...func(context.Context) []string, ) error
StartPeriodic is used to run jobs periodically. The waitTime argument defines how long to wait after jobs are finished to create new ones. The addJobs argument should be a function that creates jobs and returns their IDs. The first round of jobs will be created immediately upon calling this function. This function blocks until the context is canceled.
Types ¶
This section is empty.