runner

package
v0.2.62 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 44 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContainerNewContainer = container.NewContainer
)

Functions

func EvalBool added in v0.2.26

func EvalBool(ctx context.Context, evaluator ExpressionEvaluator, expr string, defaultStatusCheck exprparser.DefaultStatusCheck) (bool, error)

EvalBool evaluates an expression against given evaluator

func Masks added in v0.2.27

func Masks(ctx context.Context) *[]string

Logger returns the appropriate logger for current context

func WithCompositeLogger added in v0.2.27

func WithCompositeLogger(ctx context.Context, masks *[]string) context.Context

func WithCompositeStepLogger added in v0.2.30

func WithCompositeStepLogger(ctx context.Context, stepID string) context.Context

func WithJobLogger

func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Config, masks *[]string, matrix map[string]interface{}) context.Context

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

func WithJobLoggerFactory added in v0.2.35

func WithJobLoggerFactory(ctx context.Context, factory JobLoggerFactory) context.Context

func WithMasks added in v0.2.27

func WithMasks(ctx context.Context, masks *[]string) context.Context

WithMasks adds a value to the context for the logger

Types

type ActionCache added in v0.2.50

type ActionCache interface {
	Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error)
	GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error)
}

type Config

type Config struct {
	Actor                              string                       // the user that triggered the event
	Workdir                            string                       // path to working directory
	ActionCacheDir                     string                       // path used for caching action contents
	ActionOfflineMode                  bool                         // when offline, use caching action contents
	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
	JSONLogger                         bool                         // use json or text logger
	LogPrefixJobID                     bool                         // switches from the full job name to the job id
	Env                                map[string]string            // env for containers
	Inputs                             map[string]string            // manually passed action inputs
	Secrets                            map[string]string            // list of secrets
	Vars                               map[string]string            // list of vars
	Token                              string                       // GitHub token
	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
	ContainerOptions                   string                       // Options for the job container
	UseGitIgnore                       bool                         // controls if paths in .gitignore should not be copied into container, default true
	GitHubInstance                     string                       // GitHub instance to use, default "github.com"
	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
	ArtifactServerAddr                 string                       // the address the artifact server binds to
	ArtifactServerPort                 string                       // the port the artifact server binds to
	NoSkipCheckout                     bool                         // do not skip actions/checkout
	RemoteName                         string                       // remote name in local git repo config
	ReplaceGheActionWithGithubCom      []string                     // Use actions from GitHub Enterprise instance to GitHub
	ReplaceGheActionTokenWithGithubCom string                       // Token of private action repo on GitHub.
	Matrix                             map[string]map[string]bool   // Matrix config to run
	ContainerNetworkMode               docker_container.NetworkMode // the network mode of job containers (the value of --network)
	ActionCache                        ActionCache                  // Use a custom ActionCache Implementation
}

Config contains the config for a new runner

type ExpressionEvaluator

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

ExpressionEvaluator is the interface for evaluating expressions

type GoGitActionCache added in v0.2.50

type GoGitActionCache struct {
	Path string
}

func (GoGitActionCache) Fetch added in v0.2.50

func (c GoGitActionCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error)

func (GoGitActionCache) GetTarArchive added in v0.2.50

func (c GoGitActionCache) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error)

type GoGitActionCacheOfflineMode added in v0.2.60

type GoGitActionCacheOfflineMode struct {
	Parent GoGitActionCache
}

func (GoGitActionCacheOfflineMode) Fetch added in v0.2.60

func (c GoGitActionCacheOfflineMode) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error)

func (GoGitActionCacheOfflineMode) GetTarArchive added in v0.2.60

func (c GoGitActionCacheOfflineMode) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error)

type JobLoggerFactory added in v0.2.35

type JobLoggerFactory interface {
	WithJobLogger() *logrus.Logger
}

type LocalRepositoryCache added in v0.2.60

type LocalRepositoryCache struct {
	Parent            ActionCache
	LocalRepositories map[string]string
	CacheDirCache     map[string]string
}

func (*LocalRepositoryCache) Fetch added in v0.2.60

func (l *LocalRepositoryCache) Fetch(ctx context.Context, cacheDir, url, ref, token string) (string, error)

func (*LocalRepositoryCache) GetTarArchive added in v0.2.60

func (l *LocalRepositoryCache) GetTarArchive(ctx context.Context, cacheDir, sha, includePrefix string) (io.ReadCloser, error)

type MappableOutput added in v0.2.22

type MappableOutput struct {
	StepID     string
	OutputName string
}

type RunContext

type RunContext struct {
	Name              string
	Config            *Config
	Matrix            map[string]interface{}
	Run               *model.Run
	EventJSON         string
	Env               map[string]string
	GlobalEnv         map[string]string // to pass env changes of GITHUB_ENV and set-env correctly, due to dirty Env field
	ExtraPath         []string
	CurrentStep       string
	StepResults       map[string]*model.StepResult
	IntraActionState  map[string]map[string]string
	ExprEval          ExpressionEvaluator
	JobContainer      container.ExecutionsEnvironment
	ServiceContainers []container.ExecutionsEnvironment
	OutputMappings    map[MappableOutput]MappableOutput
	JobName           string
	ActionPath        string
	Parent            *RunContext
	Masks             []string
	// contains filtered or unexported fields
}

RunContext contains info about current job

func (*RunContext) ActionCacheDir added in v0.2.2

func (rc *RunContext) ActionCacheDir() string

ActionCacheDir is for rc

func (*RunContext) AddMask added in v0.2.26

func (rc *RunContext) AddMask(mask string)

func (*RunContext) ApplyExtraPath added in v0.2.35

func (rc *RunContext) ApplyExtraPath(ctx context.Context, env *map[string]string)

func (*RunContext) Executor

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

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

func (*RunContext) GetBindsAndMounts added in v0.2.22

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

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

func (*RunContext) GetEnv

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

GetEnv returns the env for the context

func (*RunContext) GetServiceBindsAndMounts added in v0.2.53

func (rc *RunContext) GetServiceBindsAndMounts(svcVolumes []string) ([]string, map[string]string)

GetServiceBindsAndMounts returns the binds and mounts for the service container, resolving paths as appropriate

func (*RunContext) IsHostEnv added in v0.2.44

func (rc *RunContext) IsHostEnv(ctx context.Context) bool

func (*RunContext) NewExpressionEvaluator

func (rc *RunContext) NewExpressionEvaluator(ctx context.Context) ExpressionEvaluator

NewExpressionEvaluator creates a new evaluator

func (*RunContext) NewExpressionEvaluatorWithEnv added in v0.2.35

func (rc *RunContext) NewExpressionEvaluatorWithEnv(ctx context.Context, env map[string]string) ExpressionEvaluator

func (*RunContext) NewStepExpressionEvaluator

func (rc *RunContext) NewStepExpressionEvaluator(ctx context.Context, step step) ExpressionEvaluator

NewStepExpressionEvaluator creates a new evaluator

func (*RunContext) String added in v0.2.5

func (rc *RunContext) String() string

func (*RunContext) UpdateExtraPath added in v0.2.35

func (rc *RunContext) UpdateExtraPath(ctx context.Context, githubEnvPath string) error

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

func NewReusableWorkflowRunner added in v0.2.35

func NewReusableWorkflowRunner(rc *RunContext) (Runner, error)

Jump to

Keyboard shortcuts

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