runner

package
v0.0.0-...-49ad519 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalBool

func EvalBool(evaluator ExpressionEvaluator, expr string) (bool, error)

EvalBool evaluates an expression against given evaluator

func WithJobLogger

func WithJobLogger(ctx context.Context, jobName string, secrets map[string]string, insecureSecrets bool) context.Context

WithJobLogger attaches a new logger to context that is aware of steps

Types

type ActionReader

type ActionReader interface {
	// contains filtered or unexported methods
}

type Config

type Config struct {
	Actor                     string                       // the user that triggered the event
	Workdir                   string                       // path to working directory
	BindWorkdir               bool                         // bind the workdir to the job container
	EventName                 string                       // name of event to run
	EventPath                 string                       // path to JSON file to use for event.json in containers
	DefaultBranch             string                       // name of the main branch for this repository
	ReuseContainers           bool                         // reuse containers to maintain state
	ForcePull                 bool                         // force pulling of the image, even if already present
	ForceRebuild              bool                         // force rebuilding local docker image action
	LogOutput                 bool                         // log the output from docker run
	Env                       map[string]string            // env for containers
	Secrets                   map[string]string            // list of secrets
	InsecureSecrets           bool                         // switch hiding output when printing to terminal
	Platforms                 map[string]string            // list of platforms
	Privileged                bool                         // use privileged mode
	UsernsMode                string                       // user namespace to use
	ContainerArchitecture     string                       // Desired OS/architecture platform for running containers
	ContainerDaemonSocket     string                       // Path to Docker daemon socket
	UseGitIgnore              bool                         // controls if paths in .gitignore should not be copied into container, default true
	GitHubInstance            string                       // GitHub instance to use, default "github.com"
	GitHubServerUrl           string                       // GitHub server url to use
	GitHubApiServerUrl        string                       // GitHub api server url to use
	GitHubGraphQlApiServerUrl string                       // GitHub graphql server url to use
	ContainerCapAdd           []string                     // list of kernel capabilities to add to the containers
	ContainerCapDrop          []string                     // list of kernel capabilities to remove from the containers
	AutoRemove                bool                         // controls if the container is automatically removed upon workflow completion
	ArtifactServerPath        string                       // the path where the artifact server stores uploads
	ArtifactServerPort        string                       // the port the artifact server binds to
	CompositeRestrictions     *model.CompositeRestrictions // describes which features are available in composite actions
	ForceRemoteCheckout       bool
}

Config contains the config for a new runner

type ExpressionEvaluator

type ExpressionEvaluator interface {
	EvaluateYamlNode(node *yaml.Node) error
	Interpolate(string) string
	// contains filtered or unexported methods
}

ExpressionEvaluator is the interface for evaluating expressions

type MappableOutput

type MappableOutput struct {
	StepID     string
	OutputName string
}

type RunContext

type RunContext struct {
	GithubContextBase *string
	Name              string
	Config            *Config
	Matrix            map[string]interface{}
	Run               *model.Run
	EventJSON         string
	Env               map[string]string
	ExtraPath         []string
	CurrentStep       string
	StepResults       map[string]*model.StepResult
	ExprEval          ExpressionEvaluator
	JobContainer      container.Container
	OutputMappings    map[MappableOutput]MappableOutput
	JobName           string

	Local            bool
	ActionPath       string
	ActionRef        string
	ActionRepository string
	Composite        *model.Action
	Inputs           map[string]interface{}
	Parent           *RunContext
	ContextData      map[string]interface{}
	// contains filtered or unexported fields
}

RunContext contains info about current job

func (*RunContext) ActionCacheDir

func (rc *RunContext) ActionCacheDir() string

ActionCacheDir is for rc

func (*RunContext) Clone

func (rc *RunContext) Clone() *RunContext

func (*RunContext) CompositeExecutor

func (rc *RunContext) CompositeExecutor() common.Executor

Executor returns a pipeline executor for all the steps in the job

func (*RunContext) ContainerWorkdir

func (rc *RunContext) ContainerWorkdir() string

Resolves the equivalent host path inside the container This is required for windows and WSL 2 to translate things like C:\Users\Myproject to /mnt/users/Myproject

func (*RunContext) Executor

func (rc *RunContext) Executor() common.Executor

Executor returns a pipeline executor for all the steps in the job

func (*RunContext) GetActPath

func (rc *RunContext) GetActPath() string

func (*RunContext) GetBindsAndMounts

func (rc *RunContext) GetBindsAndMounts() ([]string, map[string]string)

Returns the binds and mounts for the container, resolving paths as appopriate

func (*RunContext) GetEnv

func (rc *RunContext) GetEnv() map[string]string

GetEnv returns the env for the context

func (*RunContext) NewExpressionEvaluator

func (rc *RunContext) NewExpressionEvaluator() ExpressionEvaluator

NewExpressionEvaluator creates a new evaluator

func (*RunContext) SetActPath

func (rc *RunContext) SetActPath(actPath string)

func (*RunContext) String

func (rc *RunContext) String() string

type Runner

type Runner interface {
	NewPlanExecutor(plan *model.Plan) common.Executor
}

Runner provides capabilities to run GitHub actions

func New

func New(runnerConfig *Config) (Runner, error)

New Creates a new Runner

type StepContext

type StepContext struct {
	RunContext *RunContext
	Step       *model.Step
	Env        map[string]string
	Cmd        []string
	Cmdline    string
	Action     *model.Action
	Needs      *model.Job
}

StepContext contains info about current job

func (*StepContext) Executor

func (sc *StepContext) Executor(ctx context.Context) common.Executor

Executor for a step context

func (*StepContext) NewExpressionEvaluator

func (sc *StepContext) NewExpressionEvaluator() ExpressionEvaluator

NewExpressionEvaluator creates a new evaluator

Jump to

Keyboard shortcuts

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