config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CanonicalConfigName = ".local-ci.yaml"

CanonicalConfigName is the default config file the CLI and server look for when nothing else is selected.

Variables

This section is empty.

Functions

func DiscoverConfigs added in v0.2.0

func DiscoverConfigs(dir string) ([]string, error)

DiscoverConfigs lists the local-ci config files present in dir (basenames only, not full paths). The canonical ".local-ci.yaml"/".local-ci.yml" sorts first; the rest follow case-insensitively. A missing or unreadable dir is reported as an error.

func IsConfigFileName added in v0.2.0

func IsConfigFileName(name string) bool

IsConfigFileName reports whether name looks like a local-ci config file: the canonical ".local-ci.yaml"/".local-ci.yml", a bare "local-ci.yaml", or any "<prefix>.local-ci.yaml" / "<prefix>-local-ci.yaml" / "<prefix>_local-ci.yaml" variant (and the .yml spellings). The separator requirement keeps unrelated names like "nonlocal-ci.yaml" out.

func ValidateConfig

func ValidateConfig(cfg *Config) error

Types

type ArtifactsConfig added in v0.2.1

type ArtifactsConfig struct {
	Paths []string `yaml:"paths"`
}

ArtifactsConfig declares files a job produces for later jobs: after the job succeeds, the listed paths (relative to the job's workdir) are copied out of its container and injected into the workspace of every subsequent job.

type BootstrapConfig added in v0.0.20

type BootstrapConfig struct {
	Run     []string `yaml:"run"`
	Timeout int      `yaml:"timeout,omitempty"`
}

type CacheConfig

type CacheConfig struct {
	Key   string   `yaml:"key"`
	Paths []string `yaml:"paths"`
}

type CleanupConfig added in v0.0.23

type CleanupConfig struct {
	Run     []string `yaml:"run"`
	Timeout int      `yaml:"timeout,omitempty"`
}

type Config

type Config struct {
	FileName        string
	Stages          []string          `yaml:"stages"`
	Jobs            []JobConfig       `yaml:"-"`
	GlobalVariables map[string]string `yaml:"variables,omitempty"`
	RemoteProvider  *RemoteProvider   `yaml:"remote_provider,omitempty"`
	CLIVariables    map[string]string `yaml:"-"`
	Bootstrap       *BootstrapConfig  `yaml:"bootstrap,omitempty"`
	Cleanup         *CleanupConfig    `yaml:"cleanup,omitempty"`
	Include         []string          `yaml:"include,omitempty"`
}

func NewConfig

func NewConfig(file string) *Config

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

func (*Config) UnmarshalYAML added in v0.0.17

func (c *Config) UnmarshalYAML(node *yaml.Node) error

type ConfigValidator added in v0.0.23

type ConfigValidator struct {
	// contains filtered or unexported fields
}

func NewConfigValidator added in v0.0.23

func NewConfigValidator(cfg *Config) *ConfigValidator

func (*ConfigValidator) Validate added in v0.0.23

func (v *ConfigValidator) Validate() error

type Duration added in v0.2.1

type Duration time.Duration

Duration is a YAML-friendly wrapper over time.Duration. It accepts either a Go duration string ("90s", "10m", "1h30m") or a bare integer, which is read as seconds.

func (Duration) Std added in v0.2.1

func (d Duration) Std() time.Duration

func (*Duration) UnmarshalYAML added in v0.2.1

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

type ExtendsList added in v0.1.2

type ExtendsList []string

func (*ExtendsList) UnmarshalYAML added in v0.1.2

func (e *ExtendsList) UnmarshalYAML(node *yaml.Node) error

type JobBootstrapConfig added in v0.0.23

type JobBootstrapConfig struct {
	Run     []string `yaml:"run"`
	Timeout int      `yaml:"timeout,omitempty"`
}

type JobCleanupConfig added in v0.0.23

type JobCleanupConfig struct {
	Run     []string `yaml:"run"`
	Timeout int      `yaml:"timeout,omitempty"`
}

type JobConfig

type JobConfig struct {
	Name         string              `yaml:"-"`
	Image        string              `yaml:"image"`
	Script       []string            `yaml:"script"`
	Stage        string              `yaml:"stage"`
	Workdir      string              `yaml:"workdir,omitempty"`
	Variables    map[string]string   `yaml:"variables,omitempty"`
	Cache        *CacheConfig        `yaml:"cache,omitempty"`
	Network      *NetworkConfig      `yaml:"network,omitempty"`
	JobBootstrap *JobBootstrapConfig `yaml:"job_bootstrap,omitempty"`
	JobCleanup   *JobCleanupConfig   `yaml:"job_cleanup,omitempty"`
	Parallel     *bool               `yaml:"parallel,omitempty"`
	Matrix       []MatrixEntry       `yaml:"matrix,omitempty"`
	MatrixGroup  string              `yaml:"-"`
	Extends      ExtendsList         `yaml:"extends,omitempty"`
	Timeout      Duration            `yaml:"timeout,omitempty"`
	Retry        int                 `yaml:"retry,omitempty"`
	Services     []ServiceConfig     `yaml:"services,omitempty"`
	Artifacts    *ArtifactsConfig    `yaml:"artifacts,omitempty"`
	Needs        NameList            `yaml:"needs,omitempty"`
}

func ExpandMatrix added in v0.1.1

func ExpandMatrix(job JobConfig) ([]JobConfig, error)

ExpandMatrix returns the variants generated by a job's matrix definition. If the job has no matrix, it returns the job unchanged in a single-element slice. Each variant has a unique Name (suffixed with key.value pairs), a fresh Variables map containing the parent's variables plus the matrix values, and a MatrixGroup field set to the original job name.

func (*JobConfig) IsParallel added in v0.1.2

func (j *JobConfig) IsParallel() bool

IsParallel returns true only when the job has explicitly opted into the per-job parallel mode (`parallel: true`). A nil pointer (no `parallel:` key in YAML) or an explicit `parallel: false` both report false.

type MatrixEntry added in v0.1.1

type MatrixEntry map[string][]string

func (*MatrixEntry) UnmarshalYAML added in v0.1.1

func (m *MatrixEntry) UnmarshalYAML(node *yaml.Node) error

type NameList added in v0.2.1

type NameList []string

NameList is a YAML field accepting a single name or a list of names (`needs: build` or `needs: [build, lint]`).

func (*NameList) UnmarshalYAML added in v0.2.1

func (n *NameList) UnmarshalYAML(node *yaml.Node) error

type NetworkConfig added in v0.0.8

type NetworkConfig struct {
	HostAccess bool `yaml:"host_access,omitempty"`
	HostMode   bool `yaml:"host_mode,omitempty"`
}

type RemoteProvider added in v0.0.17

type RemoteProvider struct {
	Url       string `yaml:"url"`
	ProjectId int    `yaml:"project_id"`
	Token     string `yaml:"access_token"`
}

type ServiceConfig added in v0.2.1

type ServiceConfig struct {
	Image     string            `yaml:"image"`
	Alias     string            `yaml:"alias,omitempty"`
	Variables map[string]string `yaml:"variables,omitempty"`
	Ready     *ServiceReady     `yaml:"ready,omitempty"`
}

ServiceConfig declares a sidecar container that runs for the duration of a job (a database, a cache, ...). The engine starts it on a per-job network before the job's script and tears it down after, so the job reaches it at its alias (e.g. postgres://db:5432). Unlike job_bootstrap — host-side commands that run to completion — a service is an engine-managed daemon with its own image, lifecycle, and readiness gate.

func (*ServiceConfig) EffectiveAlias added in v0.2.1

func (s *ServiceConfig) EffectiveAlias() string

EffectiveAlias is the network hostname the job reaches the service at: the explicit alias, or the image's last path segment without tag/digest (registry.example.com/group/postgres:16 → "postgres").

func (*ServiceConfig) UnmarshalYAML added in v0.2.1

func (s *ServiceConfig) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts either the full mapping form or the string shorthand `- postgres:16`, which sets the image and derives the alias.

type ServiceReady added in v0.2.1

type ServiceReady struct {
	Command string   `yaml:"command,omitempty"`
	Timeout Duration `yaml:"timeout,omitempty"`
}

ServiceReady gates the job's start on the service being usable. With a command, the engine execs it inside the service container until it exits 0. Without one, it waits for the image's HEALTHCHECK (when defined) or for the container to be running.

Jump to

Keyboard shortcuts

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