jobs

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

package jobs implements

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogs added in v0.6.0

func WithLogs(logs *file.Streamer) func(*Job)

func WithRunExitWaitTime added in v0.6.0

func WithRunExitWaitTime(waitTime time.Duration) func(*Job)

Types

type Job

type Job struct {
	TmpDir  string
	WorkDir string
	Ctx     context.Context // The context used to manage the Job's entire lifetime.
	ID      string          // The ID of the job to run/being run. Must be unique. Typically this will be the CI job ID.
	// contains filtered or unexported fields
}

func New

func New(jobID, workDir string, options ...func(*Job)) (*Job, error)

func (*Job) Close

func (j *Job) Close()

Close() cancels jobs (if still running) and cleans up all resources associated with managing the job.

func (*Job) FollowLogs

func (j *Job) FollowLogs(ctx context.Context, offset int64, writer io.Writer) error

FollowLogs writes the stdout/stderr captured from running steps to the supplied writer. The function blocks until the steps are run and logs are written to the writer. Errors returned are indicative of failure to write to the writer, not failure of running steps.

func (*Job) Logs

func (j *Job) Logs() (io.Writer, io.Writer)

Logs returns a pair of io.Writers corresponding to the Job's stdout and stderr (in that order).

func (*Job) Run

func (j *Job) Run(stepsCtx *runner.StepsContext, step runner.Step)

Run actually starts execution of the steps request and captures the result. It is intended to be run in a goroutine.

func (*Job) Status

func (j *Job) Status() *proto.Status

Status returns a proto.Status objected representing the current status of the job. If the job has not Finished, some fields may be empty/nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL