configuration

package
v3.127.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// Template of the cache entry.
	Template string
	// The registry to use which defaults to "~".
	Registry string
	// ID of the cache entry to save.
	ID string
	// Key of the cache entry to save, this can be a template string.
	Key string
	// Fallback keys to use, this is a comma delimited list of key template strings.
	FallbackKeys []string
	// Paths to remove.
	Paths []string
}

func ExpandCacheConfiguration

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

Takes a list of cache configurations and expands them into a list of cache of resolved Cache objects. This does the following:

* Expands cache.Template with the template values from template.json

* Expands cache.Key using templatable arguments (such as id, agent.os, agent.arch, env, checksum etc)

* Expands cache.FallbackKeys using templatable arguments (such as id, agent.os, agent.arch, env, checksum etc)

* Expands cache.Paths using templatable arguments (such as id, agent.os, agent.arch, env, checksum etc)

Uses the OS environment variables for template expansion.

func ExpandCacheConfigurationWithEnv

func ExpandCacheConfigurationWithEnv(caches []Cache, env map[string]string) ([]Cache, error)

ExpandCacheConfigurationWithEnv expands cache configurations using a provided environment map instead of reading from the OS environment. This is useful for library usage where the environment is controlled programmatically.

Parameters:

  • caches: List of cache configurations to expand
  • env: Map of environment variables to use for template expansion

Returns the expanded cache configurations or an error if expansion fails.

func LoadFile

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

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

func (Cache) Validate

func (c Cache) Validate() error

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

Jump to

Keyboard shortcuts

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