Documentation
¶
Index ¶
- func EvaluateWorkflowConcurrency(rc *model.RawConcurrency, gitCtx *model.GithubContext, vars map[string]string, ...) (string, *bool, error)
- func NewInterpreter(jobID string, job *model.Job, matrix map[string]any, ...) exprparser.Interpreter
- func NewWorkflowInterpreter(gitCtx *model.GithubContext, vars map[string]string, inputs map[string]any) exprparser.Interpreter
- type ContainerSpec
- type Defaults
- type Event
- type ExpressionEvaluator
- type Job
- type JobResult
- type ParseOption
- type RunDefaults
- type SingleWorkflow
- type Step
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvaluateWorkflowConcurrency ¶ added in v11.1.2
func EvaluateWorkflowConcurrency(rc *model.RawConcurrency, gitCtx *model.GithubContext, vars map[string]string, inputs map[string]any) (string, *bool, error)
Convert the raw YAML from the `concurrency` block on a workflow into the evaluated concurrency group and cancel-in-progress value. This implementation only supports workflow-level concurrency definition, where we expect expressions to be able to access only the github, inputs and vars contexts. If RawConcurrency is empty, then the returned concurrency group will be "" and cancel-in-progress will be nil -- this can be used to distinguish from an explicit cancel-in-progress choice even if a group isn't specified.
func NewInterpreter ¶ added in v11.3.0
func NewInterpreter( jobID string, job *model.Job, matrix map[string]any, gitCtx *model.GithubContext, results map[string]*JobResult, vars map[string]string, inputs map[string]any, ) exprparser.Interpreter
func NewWorkflowInterpreter ¶ added in v11.3.0
func NewWorkflowInterpreter( gitCtx *model.GithubContext, vars map[string]string, inputs map[string]any, ) exprparser.Interpreter
Returns an interpreter used in the server in the context of workflow-level templates. Needs github, inputs, and vars context only.
Types ¶
type ContainerSpec ¶
type ContainerSpec struct {
Image string `yaml:"image,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
Ports []string `yaml:"ports,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Options string `yaml:"options,omitempty"`
Credentials map[string]string `yaml:"credentials,omitempty"`
Cmd []string `yaml:"cmd,omitempty"`
}
type Defaults ¶
type Defaults struct {
Run RunDefaults `yaml:"run,omitempty"`
}
type Event ¶
type Event struct {
Name string
// contains filtered or unexported fields
}
func (*Event) IsSchedule ¶
type ExpressionEvaluator ¶
type ExpressionEvaluator struct {
// contains filtered or unexported fields
}
ExpressionEvaluator is copied from runner.expressionEvaluator, to avoid unnecessary dependencies
func NewExpressionEvaluator ¶
func NewExpressionEvaluator(interpreter exprparser.Interpreter) *ExpressionEvaluator
func (ExpressionEvaluator) EvaluateYamlNode ¶
func (ee ExpressionEvaluator) EvaluateYamlNode(node *yaml.Node) error
func (ExpressionEvaluator) Interpolate ¶
func (ee ExpressionEvaluator) Interpolate(in string) string
type Job ¶
type Job struct {
Name string `yaml:"name,omitempty"`
RawNeeds yaml.Node `yaml:"needs,omitempty"`
RawRunsOn yaml.Node `yaml:"runs-on,omitempty"`
Env yaml.Node `yaml:"env,omitempty"`
If yaml.Node `yaml:"if,omitempty"`
Steps []*Step `yaml:"steps,omitempty"`
TimeoutMinutes string `yaml:"timeout-minutes,omitempty"`
Services map[string]*ContainerSpec `yaml:"services,omitempty"`
Strategy Strategy `yaml:"strategy,omitempty"`
RawContainer yaml.Node `yaml:"container,omitempty"`
Defaults Defaults `yaml:"defaults,omitempty"`
Outputs map[string]string `yaml:"outputs,omitempty"`
Uses string `yaml:"uses,omitempty"`
With map[string]any `yaml:"with,omitempty"`
RawSecrets yaml.Node `yaml:"secrets,omitempty"`
RawConcurrency *model.RawConcurrency `yaml:"concurrency,omitempty"`
}
func (*Job) EraseNeeds ¶
type ParseOption ¶
type ParseOption func(c *parseContext)
func WithGitContext ¶
func WithGitContext(context *model.GithubContext) ParseOption
func WithInputs ¶ added in v11.3.0
func WithInputs(inputs map[string]any) ParseOption
func WithJobResults ¶
func WithJobResults(results map[string]string) ParseOption
func WithVars ¶
func WithVars(vars map[string]string) ParseOption
type RunDefaults ¶
type SingleWorkflow ¶
type SingleWorkflow struct {
Name string `yaml:"name,omitempty"`
RawOn yaml.Node `yaml:"on,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
RawJobs yaml.Node `yaml:"jobs,omitempty"`
Defaults Defaults `yaml:"defaults,omitempty"`
}
SingleWorkflow is a workflow with single job and single matrix
func Parse ¶
func Parse(content []byte, validate bool, options ...ParseOption) ([]*SingleWorkflow, error)
func (*SingleWorkflow) Job ¶
func (w *SingleWorkflow) Job() (string, *Job)
func (*SingleWorkflow) Marshal ¶
func (w *SingleWorkflow) Marshal() ([]byte, error)
type Step ¶
type Step struct {
ID string `yaml:"id,omitempty"`
If yaml.Node `yaml:"if,omitempty"`
Name string `yaml:"name,omitempty"`
Uses string `yaml:"uses,omitempty"`
Run string `yaml:"run,omitempty"`
WorkingDirectory string `yaml:"working-directory,omitempty"`
Shell string `yaml:"shell,omitempty"`
Env yaml.Node `yaml:"env,omitempty"`
With map[string]string `yaml:"with,omitempty"`
ContinueOnError bool `yaml:"continue-on-error,omitempty"`
TimeoutMinutes string `yaml:"timeout-minutes,omitempty"`
}