constraint

package
v3.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSkipCommitMessage added in v3.14.0

func IsSkipCommitMessage(event metadata.Event, commitMessage string) bool

Types

type Constraint

type Constraint struct {
	Ref      List                          `yaml:"ref,omitempty"`
	Repo     List                          `yaml:"repo,omitempty"`
	Instance List                          `yaml:"instance,omitempty"`
	Platform List                          `yaml:"platform,omitempty"`
	Branch   List                          `yaml:"branch,omitempty"`
	Cron     List                          `yaml:"cron,omitempty"`
	Status   yaml_base_types.StringOrSlice `yaml:"status,omitempty"`
	Matrix   Map                           `yaml:"matrix,omitempty"`
	Local    optional.Option[bool]         `yaml:"local,omitempty"`
	Path     Path                          `yaml:"path,omitempty"`
	Evaluate string                        `yaml:"evaluate,omitempty"`
	Event    yaml_base_types.StringOrSlice `yaml:"event,omitempty"`
}

func (*Constraint) Match

func (c *Constraint) Match(m metadata.Metadata, global bool, env map[string]string) (bool, error)

Match returns true if all constraints match the given input. If a single constraint fails a false value is returned.

type Dependency added in v3.15.0

type Dependency struct {
	Name     string `yaml:"name"`
	Optional bool   `yaml:"optional,omitempty"`
}

Dependency represents a single dependency with an optional flag. When optional is true, the dependency is silently dropped if the referenced step or workflow is not present in the pipeline.

type DependsOn added in v3.15.0

type DependsOn []Dependency

DependsOn represents a list of dependencies that can be unmarshalled from:

  • a string: "step-a"
  • a string array: ["step-a", "step-b"]
  • an object array: [{name: "step-a", optional: true}]
  • a mixed array: ["step-a", {name: "step-b", optional: true}]

func (DependsOn) IsZero added in v3.15.0

func (d DependsOn) IsZero() bool

IsZero treats only a nil DependsOn as empty for omitempty purposes. A non-nil empty slice means depends_on was present in the YAML, which the step compiler reads as DAG mode (vs nil = sequential).

func (DependsOn) MarshalYAML added in v3.15.0

func (d DependsOn) MarshalYAML() (any, error)

MarshalYAML emits a single string for one required dep, a string array for many, an object array if any dep is optional, and an empty array for a non-nil empty slice (the step DAG-mode signal — see IsZero).

func (DependsOn) Names added in v3.15.0

func (d DependsOn) Names() []string

Names returns all dependency names.

func (DependsOn) OptionalNames added in v3.15.0

func (d DependsOn) OptionalNames() []string

OptionalNames returns names of optional dependencies.

func (DependsOn) RequiredNames added in v3.15.0

func (d DependsOn) RequiredNames() []string

RequiredNames returns names of non-optional dependencies.

func (*DependsOn) UnmarshalYAML added in v3.15.0

func (d *DependsOn) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the Unmarshaler interface.

type List

type List struct {
	Include []string
	Exclude []string
}

List defines a runtime constraint for exclude & include string slices.

func (*List) Excludes

func (c *List) Excludes(v string) bool

Excludes returns true if the string matches the exclude patterns.

func (*List) Includes

func (c *List) Includes(v string) bool

Includes returns true if the string matches the include patterns.

func (List) IsEmpty

func (c List) IsEmpty() bool

IsEmpty return true if a constraint has no conditions.

func (List) MarshalYAML added in v3.12.0

func (c List) MarshalYAML() (any, error)

MarshalYAML implements custom Yaml marshaling.

func (*List) Match

func (c *List) Match(v string) bool

Match returns true if the string matches the include patterns and does not match any of the exclude patterns.

func (*List) UnmarshalYAML

func (c *List) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML unmarshal the constraint.

type Map

type Map struct {
	Include map[string]string `yaml:"include,omitempty"`
	Exclude map[string]string `yaml:"exclude,omitempty"`
}

Map defines a runtime constraint for exclude & include map strings.

func (Map) MarshalYAML added in v3.12.0

func (c Map) MarshalYAML() (any, error)

MarshalYAML implements custom Yaml marshaling.

func (*Map) Match

func (c *Map) Match(params map[string]string) bool

Match returns true if the params matches the include key values and does not match any of the exclude key values.

func (*Map) UnmarshalYAML

func (c *Map) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML unmarshal the constraint map.

type Path

type Path struct {
	Include       []string              `yaml:"include,omitempty"`
	Exclude       []string              `yaml:"exclude,omitempty"`
	IgnoreMessage string                `yaml:"ignore_message,omitempty"`
	OnEmpty       optional.Option[bool] `yaml:"on_empty,omitempty"`
}

Path defines a runtime constrain for exclude & include paths.

func (*Path) Excludes

func (c *Path) Excludes(v []string) bool

Excludes returns true if all of the strings match any of the exclude patterns.

func (*Path) Includes

func (c *Path) Includes(v []string) bool

Includes returns true if the string matches any of the include patterns.

func (Path) MarshalYAML added in v3.12.0

func (c Path) MarshalYAML() (any, error)

MarshalYAML implements custom Yaml marshaling.

func (*Path) Match

func (c *Path) Match(v []string, message string) bool

Match returns true if file paths in string slice matches the include and not exclude patterns or if commit message contains ignore message.

func (*Path) UnmarshalYAML

func (c *Path) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML unmarshal the constraint.

type When

type When struct {
	// If true then read from a list of constraint
	Constraints []Constraint
}

When defines a set of runtime constraints.

func (*When) IncludesStatusFailure

func (when *When) IncludesStatusFailure(metadata metadata.Metadata, global bool, env map[string]string) bool

func (*When) IncludesStatusSuccess

func (when *When) IncludesStatusSuccess(metadata metadata.Metadata, global bool, env map[string]string) bool

func (*When) IsEmpty

func (when *When) IsEmpty() bool

func (*When) IsLocal

func (when *When) IsLocal() bool

False if (any) non local.

func (When) MarshalYAML added in v3.12.0

func (when When) MarshalYAML() (any, error)

MarshalYAML implements custom Yaml marshaling.

func (*When) Match

func (when *When) Match(metadata metadata.Metadata, global bool, env map[string]string) (bool, error)

Returns true if at least one of the internal constraints is true.

func (*When) UnmarshalYAML

func (when *When) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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