constraint

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

type Constraint struct {
	Ref         List
	Repo        List
	Instance    List
	Platform    List
	Environment List
	Branch      List
	Cron        List
	Status      List
	Matrix      Map
	Local       yamlBaseTypes.BoolTrue
	Path        Path
	Evaluate    string `yaml:"evaluate,omitempty"`
	// TODO: change to StringOrSlice in 3.x
	Event List
}

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 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) 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
	Exclude map[string]string
}

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

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
	Exclude       []string
	IgnoreMessage string                 `yaml:"ignore_message,omitempty"`
	OnEmpty       yamlBaseTypes.BoolTrue `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 the string matches 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) 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() bool

func (*When) IncludesStatusSuccess

func (when *When) IncludesStatusSuccess() bool

func (*When) IsEmpty

func (when *When) IsEmpty() bool

func (*When) IsLocal

func (when *When) IsLocal() bool

False if (any) non local.

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