configuration

package
v4.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveCacheKey

func ResolveCacheKey(keyParts []KeyPart, env map[string]string) ([]api.CacheKeyPart, error)

ResolveCacheKey resolves each KeyPart to its concrete value and returns the flat wire shape the backend expects. A part is mandatory iff it is at or before the part declaring fallbackLimit; parts after it are optional. When no part declares fallbackLimit, every part is mandatory. At most one part may declare it (enforced by Validate).

Types

type Cache

type Cache struct {
	// Name of the cache entry to save.
	Name string `yaml:"name"`
	// Key of the cache entry to save, this can be a template string.
	CacheKey []KeyPart `yaml:"cache_key"`
	// Target Paths to remove.
	TargetPaths []string `yaml:"target_paths"`
}

func ExpandCacheConfiguration

func ExpandCacheConfiguration(caches []Cache) ([]Cache, error)

ExpandCacheConfiguration returns the cache definitions unchanged. Cache keys are resolved at send time (see ResolveCacheKey), so there is nothing to expand at load time.

func LoadFile

func LoadFile(path string) ([]Cache, error)

LoadFile reads a cache configuration YAML file and returns the cache definitions declared under its "caches" key. Returns an empty slice (and no error) when the file declares no caches.

func (Cache) Validate

func (c Cache) Validate() error

Validate validates the cache configuration and returns an error if invalid.

type KeyPart

type KeyPart struct {
	Arg    string
	Source Source
	// FallbackLimit marks the fallback boundary: this part and every part before
	// it are mandatory; parts after it are optional. At most one part may set it.
	FallbackLimit bool
}

func (KeyPart) Resolve

func (k KeyPart) Resolve(env map[string]string) (string, error)

func (*KeyPart) UnmarshalYAML

func (k *KeyPart) UnmarshalYAML(node *yaml.Node) error

type Source

type Source string
const (
	SourceLiteral  Source = "literal"
	SourceAgent    Source = "agent"
	SourceEnv      Source = "env"
	SourceChecksum Source = "checksum"
)

Jump to

Keyboard shortcuts

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