runner

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package runner implements the backend that executes the jobs.

Docker runner uses the docker runtime to execute jobs.

Index

Constants

View Source
const (
	ARTIFACTS_DIR = ".artifacts"
	WORKING_DIR   = "/app"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerRunner

type DockerRunner struct {
	// contains filtered or unexported fields
}

func NewDockerRunner

func NewDockerRunner(name string, artifactManager artifacts.ArtifactManager, dockerOptions DockerRunnerOptions) *DockerRunner

func (*DockerRunner) CreatesArtifacts

func (d *DockerRunner) CreatesArtifacts(artifacts []string) *DockerRunner

CreatesArtifacts is used to specify the files that will be stored as artifacts. The input is a list of file paths wrt the src specified in WithSrc.

func (*DockerRunner) Run

func (d *DockerRunner) Run(ctx context.Context) error

Run creates the container based on the provided configuration.

func (*DockerRunner) WithCmd

func (d *DockerRunner) WithCmd(cmd []string) *DockerRunner

WithCmd specifies the script that should be run inside the container.

func (*DockerRunner) WithCredentials

func (d *DockerRunner) WithCredentials(username, password string) *DockerRunner

WithCredentials can be used to specify the credentials for a private image registry.

func (*DockerRunner) WithEntrypoint

func (d *DockerRunner) WithEntrypoint(entrypoint []string) *DockerRunner

WithEntrypoint can be used to override the default entrypoint in a docker image.

func (*DockerRunner) WithEnv

func (d *DockerRunner) WithEnv(env []models.Variable) *DockerRunner

WithEnv is used to specify job variables. Env is an array of map[string]any. The length of the map should be 1.

func (*DockerRunner) WithImage

func (d *DockerRunner) WithImage(image string) *DockerRunner

WithImage takes the image url as input and returns a Docker runner. The image url format is the same one used in docker pull <url>.

func (*DockerRunner) WithSrc

func (d *DockerRunner) WithSrc(src string) *DockerRunner

WithSrc takes the src location and returns a Docker runner. The src is the path to the folder that will be copied into the docker container for running the job.

type DockerRunnerOptions

type DockerRunnerOptions struct {
	ShowImagePull     bool
	Stdout            io.Writer
	Stderr            io.Writer
	MountDockerSocket bool
}

Jump to

Keyboard shortcuts

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