Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeBoolToHealthcheck(defaultHealthcheck HealthcheckConfig) mapstructure.DecodeHookFuncKind
- func LockFilepath(ymlFile string) string
- type BuildDef
- type BuildOpts
- type Context
- type ContextType
- type GitContext
- type HealthcheckCmd
- type HealthcheckConfig
- type HealthcheckFCGI
- type HealthcheckHTTP
- type HealthcheckType
- type Locks
- type OSRelease
- type PathsMap
- type RawLocks
- type UpdateLocksOpts
- type VersionMap
- func (set *VersionMap) Add(name, val string)
- func (set *VersionMap) Copy() *VersionMap
- func (set *VersionMap) Has(name string) bool
- func (set *VersionMap) Len() int
- func (set *VersionMap) Map() map[string]string
- func (set *VersionMap) Merge(overriding *VersionMap)
- func (set *VersionMap) Names() []string
- func (set *VersionMap) Overwrite(name, val string)
- func (set *VersionMap) Remove(name string)
Constants ¶
const ( HealthcheckTypeDisabled = HealthcheckType("disabled") HealthcheckTypeHTTP = HealthcheckType("http") HealthcheckTypeFCGI = HealthcheckType("fcgi") HealthcheckTypeCmd = HealthcheckType("cmd") )
Variables ¶
var ( ContextTypeGit = ContextType("git") ContextTypeLocal = ContextType("local") )
var (
ZbuildLabel = "io.zbuild"
)
Functions ¶
func DecodeBoolToHealthcheck ¶
func DecodeBoolToHealthcheck( defaultHealthcheck HealthcheckConfig, ) mapstructure.DecodeHookFuncKind
func LockFilepath ¶
Types ¶
type BuildDef ¶
type BuildDef struct { // Kind property which represent the type of specialized build definition // the RawConfig property is holding. Kind string `yaml:"kind"` // RawConfig is the map of properties used by that specific Kind of // specialized build definition. RawConfig map[string]interface{} `yaml:",inline" hash:"set"` // RawLocks holds the map of locked properties used by that specific Kind // of specialized build definition. RawLocks RawLocks `yaml:"-" hash:"-"` }
BuildDef is the generic data structure holding a generic build definition. It's composed of a kind, the only generic property, and of a RawConfig, which holds all the specialized properties (depending on the Kind). Also, it contains the RawLocks associated with the RawConfig.
type BuildOpts ¶
type BuildOpts struct { Def *BuildDef SourceState *llb.State SessionID string // LocalUniqueID is useful mostly for test purpose, in order to use // a predefine value and have stable op digests. LocalUniqueID string // IgnoreLayerCache determines wheter layer caching shall be disabled. It's // the responsibility of specialized kind handlers to correctly apply this // option. IgnoreLayerCache bool // WithCacheMounts determines if the specialized builders should use a // custom cache to store downloaded pckages, compiled files, etc... WithCacheMounts bool CacheIDNamespace string File string LockFile string Stage string BuildContext *Context }
BuildOpts represents the parameters passed to specialized builders. (see github.com/NiR-/zbuild/pkg/defkinds/)
func NewBuildOpts ¶
type Context ¶
type Context struct { GitContext `mapstructure:",squash"` Type ContextType // Source is either the name of the local context or the URI of the remote // context. Source string `mapstructure:"source"` }
func NewContext ¶
NewContext takes a source which can be either a string starting with "git://" followed by a repo URI or a local context name. It also takes an optional contextType that can be used to force the type of the context (no inference on the source format will be done).
func (*Context) IsGitContext ¶
func (*Context) IsLocalContext ¶
func (*Context) Subdir ¶
Subdir returns the context Path if the context is Git-based. This method should be prefered over accessing Path directly since the Path can be set by users. It doesn't support local context because Buildkit clients' scope the build contexts to the build dir they're instructed to use. Thus, context dir for local contexts as no meaning.
type ContextType ¶
type ContextType string
func (ContextType) IsValid ¶
func (ctype ContextType) IsValid() error
type GitContext ¶
type HealthcheckCmd ¶
HealthcheckCmd are healthcheck parameters that can be specified in specialized definition files when using cmd healthcheck type.
type HealthcheckConfig ¶
type HealthcheckConfig struct { *HealthcheckHTTP `mapstructure:"http"` *HealthcheckFCGI `mapstructure:"fcgi"` *HealthcheckCmd `mapstructure:"cmd"` Type HealthcheckType Interval time.Duration Timeout time.Duration Retries int }
HealthcheckConfig represents healthcheck as specified in specialized definition files.
func (*HealthcheckConfig) IsEnabled ¶
func (hc *HealthcheckConfig) IsEnabled() bool
func (*HealthcheckConfig) IsValid ¶
func (hc *HealthcheckConfig) IsValid(allowedTypes []string) bool
func (*HealthcheckConfig) ToImageConfig ¶
func (hc *HealthcheckConfig) ToImageConfig() *image.HealthConfig
type HealthcheckFCGI ¶
HealthcheckFCGI are healthcheck parameters that can be specified in specialized definition files when using fcgi healthcheck type.
type HealthcheckHTTP ¶
HealthcheckHTTP are healthcheck parameters that can be specified in specialized definition files when using http healthcheck type.
type HealthcheckType ¶
type HealthcheckType string
func (HealthcheckType) IsValid ¶
func (hcType HealthcheckType) IsValid(allowed []string) bool
type Locks ¶
type Locks interface {
RawLocks() map[string]interface{}
}
Locks define a common interface implemented by all specialized Locks structs. Its unique method returns the locks as a map of interfaces, as used by mapstructure. This lets builder package arbitrarily manipulate the locks before writing them to disk. This is used to add the webserver locks when a webserver definition is embedded in a zbuildfile of another kind.
type OSRelease ¶
OSRelease represents the data about a Linux distribution as read from /etc/os-release. This struct is generally part of specialized definition locks and is used to determine which packages should be picked (e.g. php system packages inference).
func ParseOSRelease ¶
ParseOSRelease takes the raw content of a /etc/os-release file and transforms it into an OSRelease.
type PathsMap ¶
PathsMap represents a set of paths with the source paths as keys and dest paths as values. It provides POSIX-like parameter expansion through its Interpolate() methods.
func (PathsMap) Interpolate ¶
func (paths PathsMap) Interpolate( srcPrefix string, basedir string, params map[string]string, ) (map[string]string, error)
Interpolate expands POSIX-like parameters from the dest paths of the map using the given map of parameters and prepends all the source paths with the given prefix. Interpolated dest paths that aren't absolute are prefixed with the given basedir.
func (PathsMap) SourcePaths ¶
SourcePaths() returns the sorted list of sources paths from the map prepended with the given prefix.
type RawLocks ¶
type RawLocks struct { // DefHash is the hash of the BuildDef the last time the locks were // generated. This is used to ensure that the lockfile is up-to-date with // the BuildDef. It's the only generic lock property, extracted from the // lockfile when loaded. DefHash uint64 `yaml:"defhash"` Raw map[string]interface{} `yaml:",inline"` }
RawLocks holds the hash of the BuildDef these RawLocks are associated to, as well as a raw map of all the locked properties.
type UpdateLocksOpts ¶
type UpdateLocksOpts struct { *BuildOpts // UpdateImageRef indicates whether the locked image reference shall be // updated. UpdateImageRef bool // UpdateSystemPackages indicates whether locked system packages shall be // updated. UpdateSystemPackages bool // UpdatePHPExtensions indicates whether PHP community extensions shall be // updated. UpdatePHPExtensions bool }
UpdateLocksOpts represents the parameters passed to specialized builders to update a lockfile.
type VersionMap ¶
VersionMap is a list of packages/extensions/etc... associated to version constraints or resolved versions. It has dedicated methods to manipulate items in the map, most notably Add() which can be used to add an item without overwriting any preexisting value. This is used in specialized defkind handlers to add infered items without rewriting manually-defined values.
func (*VersionMap) Add ¶
func (set *VersionMap) Add(name, val string)
func (*VersionMap) Copy ¶
func (set *VersionMap) Copy() *VersionMap
func (*VersionMap) Has ¶
func (set *VersionMap) Has(name string) bool
func (*VersionMap) Len ¶
func (set *VersionMap) Len() int
Len returns the number of versions in the map or 0 if the map is nil.
func (*VersionMap) Map ¶
func (set *VersionMap) Map() map[string]string
func (*VersionMap) Merge ¶
func (set *VersionMap) Merge(overriding *VersionMap)
func (*VersionMap) Names ¶
func (set *VersionMap) Names() []string
func (*VersionMap) Overwrite ¶
func (set *VersionMap) Overwrite(name, val string)
func (*VersionMap) Remove ¶
func (set *VersionMap) Remove(name string)