dalec

package module
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

README

Dalec

Dalec is a project aimed at providing a declarative format for building system packages and containers from those packages.

Our goal is to provide a secure way to build packages and containers, with a focus on supply chain security.

Features

  • 🐳 No additional tools are needed except for Docker!
  • 🚀 Easy to use declarative configuration
  • 📦 Build packages and/or containers for a number of different targets
    • DEB-based: Debian, and Ubuntu
    • RPM-based: Azure Linux, Rocky Linux, and Alma Linux
    • Windows containers (cross compilation only)
  • 🔌 Pluggable support for other operating systems
  • 🤏 Minimal image size, resulting in less vulnerabilities and smaller attack surface
  • 🪟 Support for Windows containers
  • ✍️ Support for signed packages
  • 🔐 Ensure supply chain security with build time SBOMs, and Provenance attestations

👉 To get started, please see Dalec documentation!

Contributing

This project welcomes contributions and suggestions. Dalec uses the Developer Certificate of Origin (DCO) to confirm authorship and licensing intent. Each commit must include a Signed-off-by line; run git commit -s to add it automatically. The CNCF-operated dco-2 GitHub App enforces this requirement on every pull request. See CONTRIBUTING.md for additional guidance.

Dalec has adopted the CNCF Code of Conduct. Refer to our Community Code of Conduct for details. For more information, see the CNCF Code of Conduct FAQ or contact conduct@cncf.io with any additional questions or comments.

Badges

OpenSSF Best Practices OpenSSF Scorecard

Copyright Contributors to Dalec, established as Dalec a Series of LF Projects, LLC.

Documentation

Index

Constants

View Source
const (
	// PreBuiltPkgSuffix is what is expected to be appended to a targetKey when it's
	// meant to be a target distro specific package (e.g. mariner2-pkg, azlinux3-pkg,
	// windowscross-pkg, bookworm-pkg, etc.). When this is provided and used to buildkit
	// and container, it will take precedence over GenericPkg.
	PreBuiltPkgSuffix = "-pkg"
	// If not a target specific package, but we want to indicate the use of a
	// prebuilt package, we use GenericPkg to indicate that it's not target specific.
	GenericPkg = "pkg"
)
View Source
const (
	CheckFileNotExistsKind      = "not_exist"
	CheckFilePermissionsKind    = "permissions"
	CheckFileLinkTargetPathKind = "link_target_path"
	CheckFileIsDirKind          = "is_dir"
	CheckOutputEmptyKind        = "empty"
	CheckOutputEqualsKind       = "equals"
	CheckOutputContainsKind     = "contains"
	CheckOutputMatchesKind      = "matches"
	CheckOutputStartsWithKind   = "starts_with"
	CheckOutputEndsWithKind     = "ends_with"
)
View Source
const (
	BazelDefaultSocketID = "bazel-default" // Default ID for bazel socket

)
View Source
const DefaultPatchStrip int = 1
View Source
const (

	// GoModCacheKey is the key used to identify the go module cache in the buildkit cache.
	// It is exported only for testing purposes.
	GomodCacheKey = "dalec-gomod-proxy-cache"
)
View Source
const (
	// KeyDalecTarget is the key used the build arg name which may be used to read
	// the target name.
	KeyDalecTarget = "DALEC_TARGET"
)

Variables

View Source
var (
	ErrNodeNotFound  = errors.New("node not found")
	ErrInvalidExtKey = errors.New("extension keys must start with \"x-\"")
)

Functions

func AllowAnyArg

func AllowAnyArg(s string) bool

AllowAnyArg can be used to set [SubstituteConfig.AllowArg] to allow any arg to be substituted regardless of whether it is declared in the spec.

func AsTar

func AsTar(worker llb.State, dest string, opts ...llb.ConstraintsOpt) llb.StateOption

AsTar returns an llb.StateOption which converts the input state into a tar with the given "dest" path as the name.

func BuildImageConfig

func BuildImageConfig(spec *Spec, targetKey string, img *DockerImageSpec) error

func CapabilitiesString added in v0.19.0

func CapabilitiesString(caps []ArtifactCapability) string

CapabilitiesString converts a list of capabilities to setcap format Returns empty string if no capabilities or all capabilities have no flags set

func DefaultTarWorker

func DefaultTarWorker(resolver llb.ImageMetaResolver, opts ...llb.ConstraintsOpt) llb.State

func DisableDiffMerge

func DisableDiffMerge(v bool)

DisableDiffMerge allows disabling the use of llb.Diff and llb.Merge in favor of llb.Copy. This is needed when the buildkit version does not support llb.Diff and llb.Merge.

Mainly this would be to allow dockerd with the (current) standard setup of dockerd which uses "graphdrivers" to work as these ops are not supported by the graphdriver backend. When this is false and the graphdriver backend is used, the build will fail when buildkit checks the capabilities of the backend.

func DisallowAllUndeclared

func DisallowAllUndeclared(s string) bool

DisallowAllUndeclared can be used to set [SubstituteConfig.AllowArg] to disallow args unless they are declared in the spec. This is used by default when substituting args.

func DuplicateMap

func DuplicateMap[K comparable, V any](m map[K]V) map[K]V

func ErrorState

func ErrorState(in llb.State, err error) llb.State

ErrorState returns a state that contains the error in an async state. If the error is nil, it returns the input state unchanged.

func ErrorStateOption

func ErrorStateOption(err error) llb.StateOption

ErrorStateOption returns a llb.StateOption that returns a state option that surfaces the error in an async state. If the error is nil, it returns a no-op state option.

func GetRepoKeys

func GetRepoKeys(configs []PackageRepositoryConfig, cfg *RepoPlatformConfig, sOpt SourceOpts, opts ...llb.ConstraintsOpt) (llb.RunOption, []string)

func HasGolang

func HasGolang(spec *Spec, targetKey string) bool

func HasNpm

func HasNpm(spec *Spec, targetKey string) bool
func InstallPostSymlinks(post *PostInstall, worker llb.State, opts ...llb.ConstraintsOpt) llb.StateOption

InstallPostSymlinks returns a RunOption that adds symlinks defined in the PostInstall underneath the provided rootfs path.

func MergeAtPath

func MergeAtPath(input llb.State, states []llb.State, dest string, opts ...llb.ConstraintsOpt) llb.State

MergeAtPath merges the given states into the given destination path in the given input state.

func MergeImageConfig

func MergeImageConfig(dst *DockerImageConfig, src *ImageConfig) error

MergeImageConfig copies the fields from the source ImageConfig into the destination image.Image. If a field is not set in the source, it is not modified in the destination. Envs from ImageConfig are merged into the destination image.Image and take precedence.

func MergeSourceLocations

func MergeSourceLocations(opts ...llb.ConstraintsOpt) llb.ConstraintsOpt

MergeSourceLocations multiple source locations into one location for each file found. It only merges locations for the provided opts, not all locations in the constraints. This is useful when there multiple ranges in a file for a single operation.

func NoopStateOption

func NoopStateOption(in llb.State) llb.State

NoopStateOption is a llb.StateOption that does not change the input state.

func PatchSources

func PatchSources(worker llb.State, spec *Spec, sourceToState map[string]llb.State, opts ...llb.ConstraintsOpt) map[string]llb.State

PatchSources returns a new map containing the patched LLB state for each source in the source map. Sources that are not patched are also included in the result for convenience. `sourceToState` must be a complete map from source name -> llb state for each source in the dalec spec. `worker` must be an LLB state with a `patch` binary present.

func Platform

func Platform(platform *ocispecs.Platform) llb.ConstraintsOpt

Platform returns a llb.ConstraintsOpt that sets the platform to the provided platform If the platform is nil, the llb.ConstraintOpt is a no-op.

func ProgressGroup

func ProgressGroup(name string) llb.ConstraintsOpt

ProgressGroup creates a progress group with the given name. If a progress group is already set in the constraints the id is reused. If no progress group is set a new id is generated.

func SetBuildNetworkMode

func SetBuildNetworkMode(spec *Spec) llb.StateOption

SetBuildNetworkMode returns an llb.StateOption that determines which

func ShArgs

func ShArgs(args string) llb.RunOption

ShArgs returns a RunOption that runs the given command in a shell.

func ShArgsf

func ShArgsf(format string, args ...interface{}) llb.RunOption

ShArgsf is the same as ShArgs but tkes a format string

func SortMapKeys

func SortMapKeys[K cmp.Ordered, V any](m map[K]V) []K

SortMapKeys is a convenience generic function to sort the keys of a map[string]T

func SortedMapIter

func SortedMapIter[K cmp.Ordered, V any](m map[K]V) iter.Seq2[K, V]

SortedMap returns an iter that yields the keys and values of the map in sorted order based on the keys.

func SortedMapValues

func SortedMapValues[T any](m map[string]T) []T

SortMapValues is like maps.Values, but the list is sorted based on the map key

func SourceIsDir

func SourceIsDir(src Source) bool

func Sources

func Sources(spec *Spec, sOpt SourceOpts, opts ...llb.ConstraintsOpt) map[string]llb.State

Sources gets all the source LLB states from the spec.

func Tar

func Tar(work llb.State, st llb.State, dest string, opts ...llb.ConstraintsOpt) llb.State

Tar creates a tar+gz from the provided state and puts it in the provided dest. The provided work state is used to perform the necessary operations to produce the tarball and requires the tar and gzip binaries.

func WithAllowAnyArg

func WithAllowAnyArg(cfg *SubstituteConfig)

WithAllowAnyArg is a SubstituteOpt that sets [SubstituteConfig.AllowArg] to AllowAnyArg.

func WithConstraint

func WithConstraint(in *llb.Constraints) llb.ConstraintsOpt

func WithConstraints

func WithConstraints(ls ...llb.ConstraintsOpt) llb.ConstraintsOpt

func WithCreateDestPath

func WithCreateDestPath() llb.CopyOption

func WithDirContentsOnly

func WithDirContentsOnly() llb.CopyOption

func WithExcludes

func WithExcludes(patterns []string) llb.CopyOption

func WithIncludes

func WithIncludes(patterns []string) llb.CopyOption

func WithMountedAptCache

func WithMountedAptCache(namePrefix string) llb.RunOption

WithMountedAptCache gives an llb.RunOption that mounts the apt cache directories. It uses the given namePrefix as the prefix for the cache keys. namePrefix should be distinct per distro version.

func WithRepoConfigs

func WithRepoConfigs(repos []PackageRepositoryConfig, cfg *RepoPlatformConfig, sOpt SourceOpts, opts ...llb.ConstraintsOpt) llb.RunOption

Returns a run option for importing the config files for all repos

func WithRepoData

func WithRepoData(repos []PackageRepositoryConfig, sOpts SourceOpts, opts ...llb.ConstraintsOpt) llb.RunOption

Returns a run option which mounts the data dirs for all specified repos

func WithRunOptions

func WithRunOptions(opts ...llb.RunOption) llb.RunOption

Types

type AddGroupConfig

type AddGroupConfig struct {
	// Name is the name of the group to add to the system.
	Name string `yaml:"name" json:"name"`
}

AddGroupConfig is the configuration for adding a group to the system.

type AddUserConfig

type AddUserConfig struct {
	// Name is the name of the user to add to the system.
	Name string `yaml:"name" json:"name"`
}

AddUserConfig is the configuration for adding a user to the system.

type ArtifactBuild

type ArtifactBuild struct {
	// Steps is the list of commands to run to build the artifact(s).
	// Each step is run sequentially and will be cached accordingly depending on the frontend implementation.
	Steps BuildStepList `yaml:"steps" json:"steps" jsonschema:"required"`
	// Env is the list of environment variables to set for all commands in this step group.
	Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`

	// NetworkMode sets the network mode to use during the build phase.
	// Accepted values: none, sandbox
	// Default: none
	NetworkMode string `yaml:"network_mode,omitempty" json:"network_mode,omitempty" jsonschema:"enum=none,enum=sandbox"`

	// Caches is the list of caches to use for the build.
	// These apply to all steps.
	Caches []CacheConfig `yaml:"caches,omitempty" json:"caches,omitempty"`
}

ArtifactBuild configures a group of steps that are run sequentially along with their outputs to build the artifact(s).

type ArtifactCapability added in v0.19.0

type ArtifactCapability struct {
	// Name is the capability name (e.g., "cap_net_raw", "cap_net_bind_service")
	Name string `yaml:"name" json:"name"`
	// Effective grants the capability in the effective set
	Effective bool `yaml:"effective,omitempty" json:"effective,omitempty"`
	// Permitted grants the capability in the permitted set
	Permitted bool `yaml:"permitted,omitempty" json:"permitted,omitempty"`
	// Inheritable grants the capability in the inheritable set
	Inheritable bool `yaml:"inheritable,omitempty" json:"inheritable,omitempty"`
}

ArtifactCapability represents a Linux Capability to set on an artifact

func (ArtifactCapability) String added in v0.19.0

func (c ArtifactCapability) String() string

String converts the capability to setcap format (e.g., "cap_net_raw=ep")

type ArtifactConfig

type ArtifactConfig struct {
	// Subpath is the subpath to use in the package for the artifact type.
	//
	// As an example, binaries are typically placed in /usr/bin when installed.
	// If you want to nest them in a subdirectory, you can specify it here.
	SubPath string `yaml:"subpath,omitempty" json:"subpath,omitempty"`
	// Name is file or dir name to use for the artifact in the package.
	// If empty, the file or dir name from the produced artifact will be used.
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// Permissions is the file permissions to set on the artifact.
	// If not set, the default value will depend on the kind of artifact or the underlying artifact's already set permissions.
	Permissions fs.FileMode `yaml:"permissions,omitempty" json:"permissions,omitempty"`
	// User is the user name that should own the artifact
	User string `yaml:"user,omitempty" json:"user,omitempty"`
	// Group is the group name that should own the artifact
	Group string `yaml:"group,omitempty" json:"group,omitempty"`
	// LinuxCapabilities is the list of Linux capabilities to set on the artifact
	LinuxCapabilities []ArtifactCapability `yaml:"linux_capabilities,omitempty" json:"linux_capabilities,omitempty"`
}

ArtifactConfig is the configuration for a given artifact type. This is used to customize where an artifact will be placed when installed.

func (*ArtifactConfig) ResolveName

func (a *ArtifactConfig) ResolveName(path string) string

type ArtifactDirConfig

type ArtifactDirConfig struct {
	// Mode is used to set the file permission bits of the final created directory to the specified mode.
	// Mode is the octal permissions to set on the dir.
	Mode fs.FileMode `yaml:"mode,omitempty" json:"mode,omitempty"`
	// User is the user name that should own the directory
	User string `yaml:"user,omitempty" json:"user,omitempty"`
	// Group is the group name that should own the directory
	Group string `yaml:"group,omitempty" json:"group,omitempty"`
}

ArtifactDirConfig contains information about the directory to be created

type ArtifactSymlinkConfig

type ArtifactSymlinkConfig struct {
	// Source is the path that is being linked to
	// Example:
	//   If you want a symlink in /usr/bin/foo that is linking to /usr/bin/foo/foo
	//   then the `Source` is `/usr/bin/foo/foo`
	Source string `yaml:"source,omitempty" json:"source,omitempty"`
	// Dest is the path where the symlink will be installed
	Dest string `yaml:"dest,omitempty" json:"dest,omitempty"`
	// User is the user name that should own the symlink
	User string `yaml:"user,omitempty" json:"user,omitempty"`
	// Group is the group name that should own the symlink
	Group string `yaml:"group,omitempty" json:"group,omitempty"`
}

type Artifacts

type Artifacts struct {
	// Binaries is the list of binaries to include in the package.
	Binaries map[string]ArtifactConfig `yaml:"binaries,omitempty" json:"binaries,omitempty"`
	// Libexec is the list of additional binaries that may be invoked by the main package binary.
	Libexec map[string]ArtifactConfig `yaml:"libexec,omitempty" json:"libexec,omitempty"`
	// Manpages is the list of manpages to include in the package.
	Manpages map[string]ArtifactConfig `yaml:"manpages,omitempty" json:"manpages,omitempty"`
	// DataDirs is a list of read-only architecture-independent data files, to be placed in /usr/share/
	DataDirs map[string]ArtifactConfig `yaml:"data_dirs,omitempty" json:"data_dirs,omitempty"`
	// Directories is a list of various directories that should be created by the package.
	Directories *CreateArtifactDirectories `yaml:"createDirectories,omitempty" json:"createDirectories,omitempty"`
	// ConfigFiles is a list of files that should be marked as config files in the package.
	ConfigFiles map[string]ArtifactConfig `yaml:"configFiles,omitempty" json:"configFiles,omitempty"`
	// Docs is a list of doc files included in the package
	Docs map[string]ArtifactConfig `yaml:"docs,omitempty" json:"docs,omitempty"`
	// Licenses is a list of doc files included in the package
	Licenses map[string]ArtifactConfig `yaml:"licenses,omitempty" json:"licenses,omitempty"`
	// Systemd is the list of systemd units and dropin files for the package
	Systemd *SystemdConfiguration `yaml:"systemd,omitempty" json:"systemd,omitempty"`

	// Libs is the list of library files to be installed.
	// On linux this would typically be installed to /usr/lib/<package name>
	Libs map[string]ArtifactConfig `yaml:"libs,omitempty" json:"libs,omitempty"`

	// Links is the list of symlinks to be installed with the package
	// Links should only be used if the *package* should contain the link.
	// For making a container compatible with another image, use [PostInstall] in
	// the [ImageConfig].
	Links []ArtifactSymlinkConfig `yaml:"links,omitempty" json:"links,omitempty"`

	// Headers is a list of header files and/or folders to be installed.
	// On linux this would typically be installed to /usr/include/.
	Headers map[string]ArtifactConfig `yaml:"headers,omitempty" json:"headers,omitempty"`

	// Users is a list of users to add to the system when the package is installed.
	Users []AddUserConfig `yaml:"users,omitempty" json:"users,omitempty"`
	// Groups is a list of groups to add to the system when the package is installed.
	Groups []AddGroupConfig `yaml:"groups,omitempty" json:"groups,omitempty"`

	// DisableStrip is used to disable stripping of artifacts.
	DisableStrip bool `yaml:"disable_strip,omitempty" json:"disable_strip,omitempty"`

	// DisableAutoRequires is used to disable automatic dependency discovery for
	// the produced package.
	//
	// Some tooling, such as `rpmbuild`, will look at all artifacts and
	// automatically inject missing dependencies into the package metadata.
	// For instance, if you include a `.sh` script, rpmbuild with automatically
	// add `bash` as a dependency for the package.
	// It also does this for libraries being linked against.
	//
	// This is useful if you want to have more control over the dependencies
	// that are included in the package.
	// However, you must be careful to manually include all dependencies that are required.
	DisableAutoRequires bool `yaml:"disable_auto_requires,omitempty" json:"disable_auto_requires,omitempty"`
}

Artifacts describes all the artifacts to include in the package. Artifacts are broken down into types, e.g. binaries, manpages, etc. This differentiation is used to determine where to place the artifact on install.

func (Artifacts) HasDocs

func (a Artifacts) HasDocs() bool

func (*Artifacts) IsEmpty

func (a *Artifacts) IsEmpty() bool

IsEmpty is used to determine if there are any artifacts to include in the package.

type BaseImage

type BaseImage struct {
	// Rootfs represents an image rootfs.
	Rootfs Source `yaml:"rootfs" json:"rootfs"`
}

func (*BaseImage) ResolveImageConfig

func (bi *BaseImage) ResolveImageConfig(ctx context.Context, sOpt SourceOpts, opt sourceresolver.Opt) ([]byte, error)

func (*BaseImage) ToState

func (bi *BaseImage) ToState(sOpt SourceOpts, opts ...llb.ConstraintsOpt) llb.State

type BazelCache

type BazelCache struct {
	// Scope adds extra information to the cache key.
	// This is useful to differentiate between different build contexts if required.
	//
	// This is mainly intended for internal testing purposes.
	Scope string `json:"scope,omitempty" yaml:"scope,omitepty"`
}

Currently this only supports setting up a *local* bazel cache.

BazelCache relies on the *system* bazelrc file to configure the default cache location. If the project being built includes its own bazelrc it may override the one configured by BazelCache.

An alternative to BazelCache would be a CacheDir and use `--disk_cache` to set the cache location when executing bazel commands.

func (*BazelCache) ToRunOption

func (c *BazelCache) ToRunOption(worker llb.State, distroKey string, opts ...BazelCacheOption) llb.RunOption

type BazelCacheInfo

type BazelCacheInfo struct {
	Platform *ocispecs.Platform
	// contains filtered or unexported fields
}

type BazelCacheOption

type BazelCacheOption interface {
	SetBazelCacheOption(*BazelCacheInfo)
}

type BazelCacheOptionFunc

type BazelCacheOptionFunc func(*BazelCacheInfo)

func (BazelCacheOptionFunc) SetBazelCacheOption

func (f BazelCacheOptionFunc) SetBazelCacheOption(info *BazelCacheInfo)

type BuildStep

type BuildStep struct {
	// Command is the command to run to build the artifact(s).
	// This will always be wrapped as /bin/sh -c "<command>", or whatever the equivalent is for the target distro.
	Command string `yaml:"command" json:"command" jsonschema:"required"`
	// Env is the list of environment variables to set for the command.
	Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`

	// Mounts is the list of sources to mount into the build step.
	Mounts []SourceMount `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	// contains filtered or unexported fields
}

BuildStep is used to execute a command to build the artifact(s).

func (*BuildStep) GetSourceLocation

func (step *BuildStep) GetSourceLocation(state llb.State) (ret llb.ConstraintsOpt)

GetSourceLocation returns an llb.ConstraintsOpt representing the source map location for this BuildStep. It returns a no-op if there is no source map or the provided state is nil.

func (*BuildStep) UnmarshalYAML

func (step *BuildStep) UnmarshalYAML(ctx context.Context, node ast.Node) error

type BuildStepList

type BuildStepList []BuildStep

func (BuildStepList) GetSourceLocation

func (ls BuildStepList) GetSourceLocation(st llb.State) llb.ConstraintsOpt

func (*BuildStepList) UnmarshalYAML

func (ls *BuildStepList) UnmarshalYAML(ctx context.Context, node ast.Node) error

type CacheConfig

type CacheConfig struct {
	// Dir specifies a generic cache directory configuration.
	Dir *CacheDir `json:"dir,omitempty" yaml:"dir,omitempty" jsonschema:"oneof_required=dir"`
	// GoBuild specifies a cache for Go's incremental build artifacts.
	// This should speed up repeated builds of Go projects.
	GoBuild *GoBuildCache `json:"gobuild,omitempty" yaml:"gobuild,omitempty" jsonschema:"oneof_required=gobuild"`
	// RustSCCache specifies a cache for Rust build artifacts.
	// This uses sccache to cache Rust compilation artifacts.
	RustSCCache *SCCache `json:"rustsccache,omitempty" yaml:"rustsccache,omitempty" jsonschema:"oneof_required=rustsccache"`
	// Bazel specifies a cache for bazel builds.
	Bazel *BazelCache `json:"bazel,omitempty" yaml:"bazel,omitempty" jsonschema:"oneof_required=bazel-local"`
}

CacheConfig configures a cache to use for a build.

func (*CacheConfig) ToRunOption

func (c *CacheConfig) ToRunOption(worker llb.State, distroKey string, opts ...CacheConfigOption) llb.RunOption

type CacheConfigOption

type CacheConfigOption interface {
	SetCacheConfigOption(*CacheInfo)
}

func WithBazelCacheConstraints

func WithBazelCacheConstraints(opts ...llb.ConstraintsOpt) CacheConfigOption

func WithCacheDirConstraints

func WithCacheDirConstraints(opts ...llb.ConstraintsOpt) CacheConfigOption

func WithGoCacheConstraints

func WithGoCacheConstraints(opts ...llb.ConstraintsOpt) CacheConfigOption

type CacheConfigOptionFunc

type CacheConfigOptionFunc func(*CacheInfo)

func (CacheConfigOptionFunc) SetCacheConfigOption

func (f CacheConfigOptionFunc) SetCacheConfigOption(info *CacheInfo)

type CacheDir

type CacheDir struct {
	// Key is the cache key to use.
	// If not set then the dest will be used.
	Key string `json:"key" yaml:"key"`
	// Dest is the directory to mount the cache to.
	Dest string `json:"dest" yaml:"dest" jsonschema:"required"`
	// Sharing is the sharing mode of the cache.
	// It can be one of the following:
	// - shared: multiple jobs can use the cache at the same time.
	// - locked: exclusive access to the cache is required.
	// - private: changes to the cache are not shared with other jobs and are discarded
	//   after the job is finished.
	Sharing string `json:"sharing" yaml:"sharing" jsonschema:"enum=shared,enum=locked,enum=private"`

	// NoAutoNamespace disables the automatic prefixing of the cache key with the
	// target specific information such as distro and CPU architecture, which may
	// be auto-injected to prevent common issues that would cause an invalid cache.
	NoAutoNamespace bool `json:"no_auto_namespace" yaml:"no_auto_namespace"`
}

CacheDir is a generic cache directory configuration.

func (*CacheDir) ToRunOption

func (c *CacheDir) ToRunOption(distroKey string, opts ...CacheDirOption) llb.RunOption

type CacheDirInfo

type CacheDirInfo struct {
	// Platform sets the platform used to generate part of the cache key when
	// CacheDir.NoAutoNamespace is set to false.
	Platform *ocispecs.Platform
}

type CacheDirOption

type CacheDirOption interface {
	SetCacheDirOption(*CacheDirInfo)
}

type CacheDirOptionFunc

type CacheDirOptionFunc func(*CacheDirInfo)

func (CacheDirOptionFunc) SetCacheDirOption

func (f CacheDirOptionFunc) SetCacheDirOption(info *CacheDirInfo)

type CacheInfo

type CacheInfo struct {
	DirInfo     CacheDirInfo
	GoBuild     GoBuildCacheInfo
	RustSCCache SCCacheInfo
	Bazel       BazelCacheInfo
}

type ChangelogEntry

type ChangelogEntry struct {
	// Date is the date of the changelog entry.
	// Dates are formatted as YYYY-MM-DD
	Date Date `yaml:"date" json:"date" jsonschema:"oneof_required=date"`
	// Author is the author of the changelog entry. e.g. `John Smith <john.smith@example.com>`
	Author string `yaml:"author" json:"author"`
	// Changes is the list of changes in the changelog entry.
	Changes []string `yaml:"changes" json:"changes"`
}

ChangelogEntry is an entry in the changelog. This is used to generate the changelog for the package.

type CheckOutput

type CheckOutput struct {
	// Equals is the exact string to compare the output to.
	Equals string `yaml:"equals,omitempty" json:"equals,omitempty"`
	// Contains is the list of strings to check if they are contained in the output.
	Contains []string `yaml:"contains,omitempty" json:"contains,omitempty"`
	// Matches is the list of regular expressions to match the output against.
	Matches []string `yaml:"matches,omitempty" json:"matches,omitempty"`
	// StartsWith is the string to check if the output starts with.
	StartsWith string `yaml:"starts_with,omitempty" json:"starts_with,omitempty"`
	// EndsWith is the string to check if the output ends with.
	EndsWith string `yaml:"ends_with,omitempty" json:"ends_with,omitempty"`
	// Empty is used to check if the output is empty.
	Empty bool `yaml:"empty,omitempty" json:"empty,omitempty"`
	// contains filtered or unexported fields
}

CheckOutput is used to specify the expected output of a check, such as stdout/stderr or a file. All non-empty fields will be checked.

func (CheckOutput) Check

func (c CheckOutput) Check(dt string, p string) (retErr error)

Check is used to check the output stream.

func (CheckOutput) GetErrSource

func (c CheckOutput) GetErrSource(err *CheckOutputError) *errdefs.Source

func (CheckOutput) IsEmpty

func (c CheckOutput) IsEmpty() bool

IsEmpty is used to determine if there are any checks to perform.

func (*CheckOutput) UnmarshalYAML

func (check *CheckOutput) UnmarshalYAML(ctx context.Context, node ast.Node) error

type CheckOutputError

type CheckOutputError struct {
	Kind     string
	Expected string
	Actual   string
	Path     string
}

CheckOutputError is used to build an error message for a failed output check for a test case.

func (*CheckOutputError) Error

func (c *CheckOutputError) Error() string

type Command

type Command struct {
	// Dir is the working directory to run the command in.
	Dir string `yaml:"dir,omitempty" json:"dir,omitempty"`

	// Mounts is the list of sources to mount into the build steps.
	Mounts []SourceMount `yaml:"mounts,omitempty" json:"mounts,omitempty"`

	// Env is the list of environment variables to set for all commands in this step group.
	Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`

	// Steps is the list of commands to run to generate the source.
	// Steps are run sequentially and results of each step should be cached.
	Steps []*BuildStep `yaml:"steps" json:"steps" jsonschema:"required"`
}

Command is used to execute a command to generate a source from a docker image.

type ConstraintsOptFunc

type ConstraintsOptFunc func(*llb.Constraints)

func (ConstraintsOptFunc) SetConstraintsOption

func (f ConstraintsOptFunc) SetConstraintsOption(c *llb.Constraints)

func (ConstraintsOptFunc) SetGitOption

func (f ConstraintsOptFunc) SetGitOption(gi *llb.GitInfo)

func (ConstraintsOptFunc) SetHTTPOption

func (f ConstraintsOptFunc) SetHTTPOption(hi *llb.HTTPInfo)

func (ConstraintsOptFunc) SetImageOption

func (f ConstraintsOptFunc) SetImageOption(ii *llb.ImageInfo)

func (ConstraintsOptFunc) SetLocalOption

func (f ConstraintsOptFunc) SetLocalOption(li *llb.LocalInfo)

func (ConstraintsOptFunc) SetOCILayoutOption

func (f ConstraintsOptFunc) SetOCILayoutOption(oi *llb.OCILayoutInfo)

func (ConstraintsOptFunc) SetRunOption

func (f ConstraintsOptFunc) SetRunOption(ei *llb.ExecInfo)

type CreateArtifactDirectories

type CreateArtifactDirectories struct {
	// Config is a list of directories the RPM should place under the system config directory (i.e. /etc)
	Config map[string]ArtifactDirConfig `yaml:"config,omitempty" json:"config,omitempty"`
	// State is a list of directories the RPM should place under the common directory for shared state and libs (i.e. /var/lib).
	State map[string]ArtifactDirConfig `yaml:"state,omitempty" json:"state,omitempty"`
}

CreateArtifactDirectories describes various directories that should be created on install. CreateArtifactDirectories represents different directory paths that are common to RPM systems.

func (*CreateArtifactDirectories) GetConfig

func (*CreateArtifactDirectories) GetState

type Date

type Date struct {
	time.Time
}

func (Date) Compare

func (d Date) Compare(other Date) int

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

func (Date) MarshalYAML

func (d Date) MarshalYAML() ([]byte, error)

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(dt []byte) error

func (*Date) UnmarshalYAML

func (d *Date) UnmarshalYAML(dt []byte) error

type DockerImageConfig

type DockerImageConfig = dockerspec.DockerOCIImageConfig

type DockerImageSpec

type DockerImageSpec = dockerspec.DockerOCIImage

func BaseImageConfig

func BaseImageConfig(platform *ocispecs.Platform) *DockerImageSpec

BaseImageConfig provides a default image config that can be used for producing images.

This is taken from https://github.com/moby/buildkit/blob/0655923d7e2884a0d514313fd688178a6da57b43/frontend/dockerfile/dockerfile2llb/image.go#L26-L39

type ExtDecodeConfig

type ExtDecodeConfig struct {
	AllowUnknownFields bool
}

type FileCheckOutput

type FileCheckOutput struct {
	CheckOutput `yaml:",inline"`
	// Permissions is the expected permissions of the file.
	Permissions fs.FileMode `yaml:"permissions,omitempty" json:"permissions,omitempty"`
	// IsDir is used to set the expected file mode to a directory.
	IsDir bool `yaml:"is_dir,omitempty" json:"is_dir,omitempty"`
	// NotExist is used to check that the file does not exist.
	NotExist bool `yaml:"not_exist,omitempty" json:"not_exist,omitempty"`

	// NoFollow indicates whether to follow symlinks when performing file checks.
	// If true, symlinks will not be followed and checks will be performed on the symlink itself.
	// If the file is not a symlink this has no effect.
	//
	// This is only used for file metadata resolution.
	// Content checks (equals/contains/...) will always follow symlinks.
	// This is generally only useful for checking existence of symlinks themselves.
	// In the future other metadata checks (like user/group ownership) would also be useful.
	NoFollow bool `yaml:"no_follow,omitempty" json:"no_follow,omitempty"`

	// LinkTarget is used to specify a link target for symlink checks.
	// This only checks the target path of the symlink and does not follow symlink chains.
	// This behaves the same regardless of NoFollow.
	LinkTarget string `yaml:"link_target,omitempty" json:"link_target,omitempty"`
	// contains filtered or unexported fields
}

FileCheckOutput is used to specify the expected output of a file.

func (FileCheckOutput) Check

func (c FileCheckOutput) Check(dt string, mode fs.FileMode, isDir bool, p, target string) error

Check is used to check the output file.

func (FileCheckOutput) GetErrSource

func (c FileCheckOutput) GetErrSource(err *CheckOutputError) *errdefs.Source

GetErrSource returns the most specific source map for the given error kind. Falls back to the file-level mapping then to embedded content checks.

func (*FileCheckOutput) UnmarshalYAML

func (check *FileCheckOutput) UnmarshalYAML(ctx context.Context, node ast.Node) error

type FilterFunc

type FilterFunc = func(string, []string, []string, ...llb.ConstraintsOpt) llb.StateOption

type ForwarderFunc

type ForwarderFunc func(llb.State, *SourceBuild, ...llb.ConstraintsOpt) (llb.State, error)

type Frontend

type Frontend struct {
	// Image specifies the frontend image to forward the build to.
	// This can be left unspecified *if* the original frontend has builtin support for the distro.
	//
	// If the original frontend does not have builtin support for the distro, this must be specified or the build will fail.
	// If this is specified then it MUST be used.
	Image string `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"required,example=docker.io/my/frontend:latest"`
	// CmdLine is the command line to use to forward the build to the frontend.
	// By default the frontend image's entrypoint/cmd is used.
	CmdLine string `yaml:"cmdline,omitempty" json:"cmdline,omitempty"`
}

Frontend encapsulates the configuration for a frontend to forward a build target to.

type GeneratorCargohome

type GeneratorCargohome struct {
	// Paths is the list of paths to run the generator on. Used to generate multi-module in a single source.
	Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"`
	// contains filtered or unexported fields
}

GeneratorCargohome is used to generate a cargo home from cargo sources

func (*GeneratorCargohome) UnmarshalYAML

func (gen *GeneratorCargohome) UnmarshalYAML(ctx context.Context, node ast.Node) error

type GeneratorGomod

type GeneratorGomod struct {
	// Paths is the list of paths to run the generator on. Used to generate multi-module in a single source.
	Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"`
	// Auth is the git authorization to use for gomods. The keys are the hosts, and the values are the auth to use for that host.
	Auth map[string]GomodGitAuth `yaml:"auth,omitempty" json:"auth,omitempty"`
	// contains filtered or unexported fields
}

GeneratorGomod is used to generate a go module cache from go module sources

func (*GeneratorGomod) UnmarshalYAML

func (gen *GeneratorGomod) UnmarshalYAML(ctx context.Context, node ast.Node) error

type GeneratorNodeMod

type GeneratorNodeMod struct {
	// Paths is the list of paths to run the generator on. Used to generate multi-module in a single source.
	Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"`
	// contains filtered or unexported fields
}

GeneratorNodeMod is used to generate a node module cache for Yarn or npm.

func (*GeneratorNodeMod) UnmarshalYAML

func (gen *GeneratorNodeMod) UnmarshalYAML(ctx context.Context, node ast.Node) error

type GeneratorPip

type GeneratorPip struct {
	// Paths is the list of paths to run the generator on. Used to generate multi-module in a single source.
	Paths []string `yaml:"paths,omitempty" json:"paths,omitempty"`

	// RequirementsFile is the name of the requirements file (default: "requirements.txt")
	RequirementsFile string `yaml:"requirements_file,omitempty" json:"requirements_file,omitempty"`

	// IndexUrl specifies a custom PyPI index URL
	IndexUrl string `yaml:"index_url,omitempty" json:"index_url,omitempty"`

	// ExtraIndexUrls specifies additional PyPI index URLs
	ExtraIndexUrls []string `yaml:"extra_index_urls,omitempty" json:"extra_index_urls,omitempty"`
	// contains filtered or unexported fields
}

func (*GeneratorPip) UnmarshalYAML

func (gen *GeneratorPip) UnmarshalYAML(ctx context.Context, node ast.Node) error

type GitAuth

type GitAuth struct {
	// Header is the name of the secret which contains the git auth header.
	// When using git auth header based authentication.
	// Note: This should not have the *actual* secret value, just the name of
	// the secret which was specified as a build secret.
	Header string `yaml:"header,omitempty" json:"header,omitempty"`
	// Token is the name of the secret which contains a git auth token when using
	// token based authentication.
	// Note: This should not have the *actual* secret value, just the name of
	// the secret which was specified as a build secret.
	Token string `yaml:"token,omitempty" json:"token,omitempty"`
	// SSH is the name of the secret which contains the ssh auth info when using
	// ssh based auth.
	// Note: This should not have the *actual* secret value, just the name of
	// the secret which was specified as a build secret.
	SSH string `yaml:"ssh,omitempty" json:"ssh,omitempty"`
}

func (*GitAuth) SetGitOption

func (a *GitAuth) SetGitOption(gi *llb.GitInfo)

SetGitOption returns an llb.GitOption which sets the auth header and token secret values in LLB if they are set.

type GoBuildCache

type GoBuildCache struct {
	// Scope adds extra information to the cache key.
	// This is useful to differentiate between different build contexts if required.
	//
	// This is mainly intended for internal testing purposes.
	Scope string `json:"scope,omitempty" yaml:"scope,omitempty"`

	// The gobuild cache may be automatically injected into a build if
	// go is detected.
	// Disabled explicitly turns this off.
	Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
}

GoBuildCache is a cache for Go build artifacts. It is used to speed up Go builds by caching the incremental builds.

func (*GoBuildCache) ToRunOption

func (c *GoBuildCache) ToRunOption(distroKey string, opts ...GoBuildCacheOption) llb.RunOption

type GoBuildCacheInfo

type GoBuildCacheInfo struct {
	Platform *ocispecs.Platform
}

type GoBuildCacheOption

type GoBuildCacheOption interface {
	SetGoBuildCacheOption(*GoBuildCacheInfo)
}

type GoBuildCacheOptionFunc

type GoBuildCacheOptionFunc func(*GoBuildCacheInfo)

func (GoBuildCacheOptionFunc) SetGoBuildCacheOption

func (f GoBuildCacheOptionFunc) SetGoBuildCacheOption(info *GoBuildCacheInfo)

type GomodGitAuth

type GomodGitAuth struct {
	// Header is the name of the secret that contains the git auth header.
	// when using git auth header based authentication.
	// Note: This should not have the *actual* secret value, just the name of
	// the secret which was specified as a build secret.
	Header string `yaml:"header,omitempty" json:"header,omitempty"`
	// Token is the name of the secret which contains a git auth token when using
	// token based authentication.
	// Note: This should not have the *actual* secret value, just the name of
	// the secret which was specified as a build secret.
	Token string `yaml:"token,omitempty" json:"token,omitempty"`
	// SSH is a struct container the name of the ssh ID which contains the
	// address of the ssh auth socket, plus the username to use for the git
	// remote.
	// Note: This should not have the *actual* socket address, just the name of
	// the ssh ID which was specified as a build secret.
	SSH *GomodGitAuthSSH `yaml:"ssh,omitempty" json:"ssh,omitempty"`
}

type GomodGitAuthSSH

type GomodGitAuthSSH struct {
	// ID is the name of the ssh socket to mount, as provided via the `--ssh`
	// flag to `docker build`.
	ID string `yaml:"id,omitempty" json:"id,omitempty"`
	// Username is the username to use with this particular git remote. If none
	// is provided, `git` will be inserted.
	Username string `yaml:"username,omitempty" json:"username,omitempty"`
}

type ImageConfig

type ImageConfig struct {
	// Entrypoint sets the image's "entrypoint" field.
	// This is used to control the default command to run when the image is run.
	Entrypoint string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
	// Cmd sets the image's "cmd" field.
	// When entrypoint is set, this is used as the default arguments to the entrypoint.
	// When entrypoint is not set, this is used as the default command to run.
	Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"`
	// Env is the list of environment variables to set in the image.
	Env []string `yaml:"env,omitempty" json:"env,omitempty"`
	// Labels is the list of labels to set in the image metadata.
	Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Volumes is the list of volumes for the image.
	// Volumes instruct the runtime to bypass the any copy-on-write filesystems and mount the volume directly to the container.
	Volumes map[string]struct{} `yaml:"volumes,omitempty" json:"volumes,omitempty"`
	// WorkingDir is the working directory to set in the image.
	// This sets the directory the container will start in.
	WorkingDir string `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	// StopSignal is the signal to send to the container to stop it.
	// This is used to stop the container gracefully.
	StopSignal string `yaml:"stop_signal,omitempty" json:"stop_signal,omitempty" jsonschema:"example=SIGTERM"`

	// Deprecated: Use [Bases] instead.
	Base string `yaml:"base,omitempty" json:"base,omitempty"`

	// Bases is used to specify a list of base images to build images for.  The
	// intent of allowing multiple bases is for cases, such as Windows, where you
	// may want to publish multiple versions of a base image in one image.
	//
	// Windows is the example here because of the way Windows works, the image
	// that the base is based off of must match the OS version of the host machine.
	// Therefore it is common to have multiple Windows images in one with a
	// different value for the os version field of the platform.
	//
	// For the most part implementations are not expected to support multiple base
	// images and may error out if multiple are specified.
	//
	// This should not be set if [Base] is also set.
	Bases []BaseImage `yaml:"bases,omitempty" json:"bases,omitempty"`

	// Post is the post install configuration for the image.
	// This allows making additional modifications to the container rootfs after the package(s) are installed.
	//
	// Use this to perform actions that would otherwise require additional tooling inside the container that is not relevant to
	// the resulting container and makes a post-install script as part of the package unnecessary.
	Post *PostInstall `yaml:"post,omitempty" json:"post,omitempty"`

	// User is the that the image should run as.
	User string `yaml:"user,omitempty" json:"user,omitempty"`
}

ImageConfig is the configuration for the output image. When the target output is a container image, this is used to configure the image.

func MergeSpecImage

func MergeSpecImage(spec *Spec, targetKey string) *ImageConfig

type InvalidPatchError

type InvalidPatchError struct {
	Source    string
	PatchSpec *PatchSpec
	Err       error
}

func (*InvalidPatchError) Error

func (s *InvalidPatchError) Error() string

func (*InvalidPatchError) Unwrap

func (s *InvalidPatchError) Unwrap() error

type InvalidSourceError

type InvalidSourceError struct {
	Name string
	Err  error
}

InvalidSourceError is an error type returned when a source is invalid.

func (*InvalidSourceError) Error

func (s *InvalidSourceError) Error() string

func (*InvalidSourceError) Unwrap

func (s *InvalidSourceError) Unwrap() error

type LLBGetter

type LLBGetter func(sOpts SourceOpts, opts ...llb.ConstraintsOpt) (llb.State, error)

type PackageConfig

type PackageConfig struct {
	// Signer is the configuration to use for signing packages
	Signer *PackageSigner `yaml:"signer,omitempty" json:"signer,omitempty"`
}

PackageConfig encapsulates the configuration for artifact targets

type PackageConstraints

type PackageConstraints struct {
	// Version is a list of version constraints for the package.
	// The format of these strings is dependent on the package manager of the target system.
	// Examples:
	//   [">=1.0.0", "<2.0.0"]
	Version []string `yaml:"version,omitempty" json:"version,omitempty"`
	// Arch is a list of architecture constraints for the package.
	// Use this to specify that a package constraint only applies to certain architectures.
	Arch []string `yaml:"arch,omitempty" json:"arch,omitempty"`
	// contains filtered or unexported fields
}

PackageConstraints is used to specify complex constraints for a package dependency.

func (*PackageConstraints) GetSourceLocation

func (pc *PackageConstraints) GetSourceLocation(state llb.State) llb.ConstraintsOpt

GetSourceLocation returns an llb.ConstraintsOpt for this package's source map or nil when not present.

func (*PackageConstraints) UnmarshalYAML

func (pc *PackageConstraints) UnmarshalYAML(ctx context.Context, node ast.Node) error

type PackageDependencies

type PackageDependencies struct {
	// Build is the list of packagese required to build the package.
	Build PackageDependencyList `yaml:"build,omitempty" json:"build,omitempty"`
	// Runtime is the list of packages required to install/run the package.
	Runtime PackageDependencyList `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	// Recommends is the list of packages recommended to install with the generated package.
	// Note: Not all package managers support this (e.g. rpm)
	Recommends PackageDependencyList `yaml:"recommends,omitempty" json:"recommends,omitempty"`
	// Sysext is the list of packages to include in the generated system
	// extension. No dependency resolution is performed when generating system
	// extensions, so all required dependencies must be explicitly listed here.
	Sysext PackageDependencyList `yaml:"sysext,omitempty" json:"sysext,omitempty"`

	// Test lists any extra packages required for running tests
	// These packages are only installed for tests which have steps that require
	// running a command in the built container.
	// Use a map so test dependencies can have PackageConstraints (and source maps).
	Test PackageDependencyList `yaml:"test,omitempty" json:"test,omitempty"`

	// ExtraRepos is used to inject extra package repositories that may be used to
	// satisfy package dependencies in various stages.
	ExtraRepos []PackageRepositoryConfig `yaml:"extra_repos,omitempty" json:"extra_repos,omitempty"`
}

PackageDependencies is a list of dependencies for a package. This will be included in the package metadata so that the package manager can install the dependencies. It also includes build-time dedendencies, which we'll install before running any build steps.

func MergeDependencies

func MergeDependencies(base, target *PackageDependencies) *PackageDependencies

MergeDependencies merges two sets of package dependencies, a base and a target. If a dependency is set in both, the one from `target` is used, otherwise, the dependency from parent is used. MergeDependencies(nil, child) = child, MergeDependencies(parent, nil) = parent

func (*PackageDependencies) GetBuild

func (*PackageDependencies) GetExtraRepos

func (p *PackageDependencies) GetExtraRepos(env string) []PackageRepositoryConfig

func (*PackageDependencies) GetRecommends

func (p *PackageDependencies) GetRecommends() PackageDependencyList

func (*PackageDependencies) GetRuntime

func (*PackageDependencies) GetSysext

func (*PackageDependencies) GetTest

type PackageDependencyList

type PackageDependencyList map[string]PackageConstraints

func (PackageDependencyList) GetSourceLocation

func (l PackageDependencyList) GetSourceLocation(state llb.State) llb.ConstraintsOpt

func (*PackageDependencyList) UnmarshalYAML

func (l *PackageDependencyList) UnmarshalYAML(ctx context.Context, node ast.Node) error

type PackageRepositoryConfig

type PackageRepositoryConfig struct {
	// Keys are the list of keys that need to be imported to use the configured
	// repositories
	Keys map[string]Source `yaml:"keys,omitempty" json:"keys,omitempty"`

	// Config list of repo configs to to add to the environment.  The format of
	// these configs are distro specific (e.g. apt/yum configs).
	Config map[string]Source `yaml:"config" json:"config"`

	// Data lists all the extra data that needs to be made available for the
	// provided repository config to work.
	// As an example, if the provided config is referencing a file backed repository
	// then data would include the file data, assuming its not already available
	// in the environment.
	Data []SourceMount `yaml:"data,omitempty" json:"data,omitempty"`
	// Envs specifies the list of environments to make the repositories available
	// during.
	// Acceptable values are:
	//  - "build"   - Repositories are added prior to installing build dependencies
	//  - "test"    - Repositories are added prior to installing test dependencies
	//  - "install" - Repositories are added prior to installing the output
	//                package in a container build target.
	Envs []string `yaml:"envs" json:"envs" jsonschema:"enum=build,enum=test,enum=install"`
}

PackageRepositoryConfig

func GetExtraRepos

func GetExtraRepos(repos []PackageRepositoryConfig, env string) []PackageRepositoryConfig

type PackageSigner

type PackageSigner struct {
	*Frontend `yaml:",inline" json:",inline"`
	// Args are passed along to the signer frontend as build args
	Args map[string]string `yaml:"args,omitempty" json:"args,omitempty"`
}

PackageSigner is the configuration for defining how to sign a package

type PatchSpec

type PatchSpec struct {
	// Source is the name of the source that contains the patch to apply.
	Source string `yaml:"source" json:"source" jsonschema:"required"`
	// Strip is the number of leading path components to strip from the patch.
	// The default is 1 which is typical of a git diff.
	Strip *int `yaml:"strip,omitempty" json:"strip,omitempty"`
	// Optional subpath to the patch file inside the source
	// This is only useful for directory-backed sources.
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
	// contains filtered or unexported fields
}

PatchSpec is used to apply a patch to a source with a given set of options. This is used in [Spec.Patches]

func (*PatchSpec) UnmarshalYAML

func (p *PatchSpec) UnmarshalYAML(ctx context.Context, node ast.Node) error

type PostInstall

type PostInstall struct {
	// Symlinks is the list of symlinks to create in the container rootfs after the package(s) are installed.
	// The key is the path the symlink should point to.
	Symlinks map[string]SymlinkTarget `yaml:"symlinks,omitempty" json:"symlinks,omitempty"`
}

PostInstall is the post install configuration for the image.

type RepoPlatformConfig

type RepoPlatformConfig struct {
	ConfigRoot string
	GPGKeyRoot string
	ConfigExt  string
}

type RunOptFunc

type RunOptFunc func(*llb.ExecInfo)

func (RunOptFunc) SetRunOption

func (f RunOptFunc) SetRunOption(ei *llb.ExecInfo)

type SCCache

type SCCache struct {
	// Scope adds extra information to the cache key.
	// This is useful to differentiate between different build contexts if required.
	//
	// This is mainly intended for internal testing purposes.
	Scope string `json:"scope,omitempty" yaml:"scope,omitempty"`
}

SCCache is a cache for Rust build artifacts. It uses sccache to speed up Rust compilation by caching build artifacts.

NOTE: This cache downloads a pre-compiled binary from GitHub. Users must explicitly include this cache in their configuration to use it, which serves as acknowledgment of the external dependency.

Future enhancement: Add support for providing sccache via build context instead of downloading from GitHub. This would add Source and BinaryPath fields to allow users to include their own verified sccache binary in the build context.

func (*SCCache) ToRunOption

func (c *SCCache) ToRunOption(distroKey string, opts ...SCCacheOption) llb.RunOption

type SCCacheInfo

type SCCacheInfo struct {
	Platform *ocispecs.Platform
}

type SCCacheOption

type SCCacheOption interface {
	SetSCCacheOption(*SCCacheInfo)
}

type SCCacheOptionFunc

type SCCacheOptionFunc func(*SCCacheInfo)

func (SCCacheOptionFunc) SetSCCacheOption

func (f SCCacheOptionFunc) SetSCCacheOption(info *SCCacheInfo)

type Source

type Source struct {
	// This is an embedded union representing all of the possible source types.
	// Exactly one must be non-nil, with all other cases being errors.
	//
	// === Begin Source Variants ===
	DockerImage *SourceDockerImage `yaml:"image,omitempty" json:"image,omitempty"`
	Git         *SourceGit         `yaml:"git,omitempty" json:"git,omitempty"`
	HTTP        *SourceHTTP        `yaml:"http,omitempty" json:"http,omitempty"`
	Context     *SourceContext     `yaml:"context,omitempty" json:"context,omitempty"`
	Build       *SourceBuild       `yaml:"build,omitempty" json:"build,omitempty"`
	Inline      *SourceInline      `yaml:"inline,omitempty" json:"inline,omitempty"`

	// Path is the path to the source after fetching it based on the identifier.
	Path string `yaml:"path,omitempty" json:"path,omitempty"`

	// Includes is a list of paths underneath `Path` to include, everything else is execluded
	// If empty, everything is included (minus the excludes)
	Includes []string `yaml:"includes,omitempty" json:"includes,omitempty"`
	// Excludes is a list of paths underneath `Path` to exclude, everything else is included
	Excludes []string `yaml:"excludes,omitempty" json:"excludes,omitempty"`

	// Generate specifies a list of dependency generators to apply to a given source.
	//
	// Generators are used to generate additional sources from this source.
	// As an example the `gomod` generator can be used to generate a go module cache from a go source.
	// How a generator operates is dependent on the actual generator.
	// Generators may also cause modifications to the build environment.
	//
	// Currently supported generators are: "gomod", "cargohome", and "pip".
	// The "gomod" generator will generate a go module cache from the source.
	// The "cargohome" generator will generate a cargo home from the source.
	// The "pip" generator will generate a pip cache from the source.
	Generate []*SourceGenerator `yaml:"generate,omitempty" json:"generate,omitempty"`
	// contains filtered or unexported fields
}

Source defines a source to be used in the build. A source can be a local directory, a git repositoryt, http(s) URL, etc.

func (Source) Doc

func (s Source) Doc(name string) io.Reader

Doc returns the details of how the source was created. This should be included, where applicable, in build in build specs (such as RPM spec files) so that others can reproduce the build.

func (*Source) IsDir

func (s *Source) IsDir() bool

func (*Source) ToMount

func (s *Source) ToMount(sOpt SourceOpts, constraints ...llb.ConstraintsOpt) (llb.State, []llb.MountOption)

func (*Source) ToState

func (s *Source) ToState(name string, sOpt SourceOpts, opts ...llb.ConstraintsOpt) llb.State

func (*Source) UnmarshalYAML

func (s *Source) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceBuild

type SourceBuild struct {
	// A source specification to use as the context for the Dockerfile build
	Source Source `yaml:"source,omitempty" json:"source,omitempty"`

	// DockerfilePath is the path to the build file in the build context
	// If not set the default is assumed by buildkit to be `Dockerfile` at the root of the context.
	DockerfilePath string `yaml:"dockerfile_path,omitempty" json:"dockerfile_path,omitempty"`

	// Target specifies the build target to use.
	// If unset, the default target is determined by the frontend implementation
	// (e.g. the dockerfile frontend uses the last build stage as the default).
	Target string `yaml:"target,omitempty" json:"target,omitempty"`
	// Args are the build args to pass to the build.
	Args map[string]string `yaml:"args,omitempty" json:"args,omitempty"`
	// contains filtered or unexported fields
}

SourceBuild is used to generate source from a DockerFile build.

func (*SourceBuild) IsDir

func (src *SourceBuild) IsDir() bool

func (*SourceBuild) UnmarshalYAML

func (s *SourceBuild) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceContext

type SourceContext struct {
	// Name is the name of the build context. By default, it is the magic name
	// `context`, recognized by Docker as the default context.
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// contains filtered or unexported fields
}

SourceContext is used to generate a source from a build context. The path to the build context is provided to the `Path` field of the owning `Source`.

func (*SourceContext) IsDir

func (src *SourceContext) IsDir() bool

func (*SourceContext) UnmarshalYAML

func (s *SourceContext) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceDockerImage

type SourceDockerImage struct {
	Ref string   `yaml:"ref" json:"ref"`
	Cmd *Command `yaml:"cmd,omitempty" json:"cmd,omitempty"`
	// contains filtered or unexported fields
}

func (*SourceDockerImage) IsDir

func (src *SourceDockerImage) IsDir() bool

func (*SourceDockerImage) UnmarshalYAML

func (s *SourceDockerImage) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceGenerator

type SourceGenerator struct {
	// Subpath is the path inside a source to run the generator from.
	Subpath string `yaml:"subpath,omitempty" json:"subpath,omitempty"`

	// Gomod is the go module generator.
	Gomod *GeneratorGomod `yaml:"gomod,omitempty" json:"gomod,omitempty" jsonschema:"oneof_required=gomod"`

	// Cargohome is the cargo home generator.
	Cargohome *GeneratorCargohome `yaml:"cargohome,omitempty" json:"cargohome,omitempty" jsonschema:"oneof_required=cargohome"`

	// Pip is the pip generator.
	Pip *GeneratorPip `yaml:"pip,omitempty" json:"pip,omitempty" jsonschema:"oneof_required=pip"`

	// NodeMod is the generic node module generator for npm.
	NodeMod *GeneratorNodeMod `yaml:"nodemod,omitempty" json:"nodemod,omitempty" jsonschema:"oneof_required=nodemod"`
}

SourceGenerator holds the configuration for a source generator. This can be used inside of a Source to generate additional sources from the given source.

func (*SourceGenerator) Validate

func (g *SourceGenerator) Validate() error

type SourceGit

type SourceGit struct {
	URL        string  `yaml:"url" json:"url"`
	Commit     string  `yaml:"commit" json:"commit"`
	KeepGitDir bool    `yaml:"keepGitDir,omitempty" json:"keepGitDir,omitempty"`
	Auth       GitAuth `yaml:"auth,omitempty" json:"auth,omitempty"`
	// contains filtered or unexported fields
}

func (*SourceGit) IsDir

func (src *SourceGit) IsDir() bool

func (*SourceGit) UnmarshalYAML

func (s *SourceGit) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceHTTP

type SourceHTTP struct {
	// URL is the URL to download the file from.
	URL string `yaml:"url" json:"url"`
	// Digest is the digest of the file to download.
	// This is used to verify the integrity of the file.
	// Form: <algorithm>:<digest>
	Digest digest.Digest `yaml:"digest,omitempty" json:"digest,omitempty"`
	// Permissions is the octal file permissions to set on the file.
	Permissions fs.FileMode `yaml:"permissions,omitempty" json:"permissions,omitempty"`
	// contains filtered or unexported fields
}

SourceHTTP is used to download a file from an HTTP(s) URL.

func (*SourceHTTP) IsDir

func (src *SourceHTTP) IsDir() bool

func (*SourceHTTP) UnmarshalYAML

func (s *SourceHTTP) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceInline

type SourceInline struct {
	// File is the inline file to generate.
	// File is treated as a literal single file.
	// [SourceIsDir] will return false when this is set.
	// This is mutually exclusive with [Dir]
	File *SourceInlineFile `yaml:"file,omitempty" json:"file,omitempty"`
	// Dir creates a directory with the given files and directories.
	// [SourceIsDir] will return true when this is set.
	// This is mutually exclusive with [File]
	Dir *SourceInlineDir `yaml:"dir,omitempty" json:"dir,omitempty"`
	// contains filtered or unexported fields
}

SourceInline is used to generate a source from inline content.

func (*SourceInline) Doc

func (s *SourceInline) Doc(w io.Writer, name string)

func (*SourceInline) IsDir

func (src *SourceInline) IsDir() bool

func (*SourceInline) UnmarshalYAML

func (s *SourceInline) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceInlineDir

type SourceInlineDir struct {
	// Files is the list of files to include in the directory.
	// The map key is the name of the file.
	//
	// Files with path separators in the key will be rejected.
	Files map[string]*SourceInlineFile `yaml:"files,omitempty" json:"files,omitempty"`
	// Permissions is the octal permissions to set on the directory.
	Permissions fs.FileMode `yaml:"permissions,omitempty" json:"permissions,omitempty"`

	// UID is the user ID to set on the directory and all files and directories within it.
	// UID must be greater than or equal to 0
	UID int `yaml:"uid,omitempty" json:"uid,omitempty"`
	// GID is the group ID to set on the directory and all files and directories within it.
	// UID must be greater than or equal to 0
	GID int `yaml:"gid,omitempty" json:"gid,omitempty"`
	// contains filtered or unexported fields
}

SourceInlineDir is used by by SourceInline to represent a filesystem directory.

func (*SourceInlineDir) Doc

func (s *SourceInlineDir) Doc(w io.Writer, name string)

Doc writes the information about the directory to the writer.

func (*SourceInlineDir) UnmarshalYAML

func (s *SourceInlineDir) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceInlineFile

type SourceInlineFile struct {
	// Contents is the content.
	Contents string `yaml:"contents,omitempty" json:"contents,omitempty"`
	// Permissions is the octal file permissions to set on the file.
	Permissions fs.FileMode `yaml:"permissions,omitempty" json:"permissions,omitempty"`
	// UID is the user ID to set on the directory and all files and directories within it.
	// UID must be greater than or equal to 0
	UID int `yaml:"uid,omitempty" json:"uid,omitempty"`
	// GID is the group ID to set on the directory and all files and directories within it.
	// UID must be greater than or equal to 0
	GID int `yaml:"gid,omitempty" json:"gid,omitempty"`
	// contains filtered or unexported fields
}

SourceInlineFile is used to specify the content of an inline source.

func (*SourceInlineFile) Doc

func (s *SourceInlineFile) Doc(w io.Writer, name string)

Doc writes the information about the file to the writer.

func (*SourceInlineFile) UnmarshalYAML

func (s *SourceInlineFile) UnmarshalYAML(ctx context.Context, node ast.Node) error

type SourceMount

type SourceMount struct {
	// Dest is the destination directory to mount to
	Dest string `yaml:"dest" json:"dest" jsonschema:"required"`

	// Spec specifies the source to mount
	Spec Source `yaml:"spec" json:"spec" jsonschema:"required"`
}

SourceMount wraps a Source with a target mount point.

func (SourceMount) ToRunOption

func (s SourceMount) ToRunOption(sOpt SourceOpts, c llb.ConstraintsOpt) llb.RunOption

type SourceOpts

type SourceOpts struct {
	Resolver         llb.ImageMetaResolver
	Forward          ForwarderFunc
	GetContext       func(string, ...llb.LocalOption) (*llb.State, error)
	TargetPlatform   *ocispecs.Platform
	GitCredHelperOpt func() (llb.RunOption, error)
}

type Spec

type Spec struct {
	// Name is the name of the package.
	Name string `yaml:"name" json:"name" jsonschema:"required"`
	// Description is a short description of the package.
	Description string `yaml:"description" json:"description" jsonschema:"required"`
	// Website is the URL to store in the metadata of the package.
	Website string `yaml:"website" json:"website"`

	// Version sets the version of the package.
	Version string `yaml:"version" json:"version" jsonschema:"required"`
	// Revision sets the package revision.
	// This will generally get merged into the package version when generating the package.
	Revision string `yaml:"revision" json:"revision" jsonschema:"required,oneof_type=string;integer"`

	// Marks the package as architecture independent.
	// It is up to the package author to ensure that the package is actually architecture independent.
	// This is metadata only.
	NoArch bool `yaml:"noarch,omitempty" json:"noarch,omitempty"`

	// Conflicts is the list of packages that conflict with the generated package.
	// This will prevent the package from being installed if any of these packages are already installed or vice versa.
	Conflicts PackageDependencyList `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
	// Replaces is the list of packages that are replaced by the generated package.
	Replaces PackageDependencyList `yaml:"replaces,omitempty" json:"replaces,omitempty"`
	// Provides is the list of things that the generated package provides.
	// This can be used to satisfy dependencies of other packages.
	// As an example, the moby-runc package provides "runc", other packages could depend on "runc" and be satisfied by moby-runc.
	// This is an advanced use case and consideration should be taken to ensure that the package actually provides the thing it claims to provide.
	Provides PackageDependencyList `yaml:"provides,omitempty" json:"provides,omitempty"`

	// Sources is the list of sources to use to build the artifact(s).
	// The map key is the name of the source and the value is the source configuration.
	// The source configuration is used to fetch the source and filter the files to include/exclude.
	// This can be mounted into the build using the "Mounts" field in the StepGroup.
	//
	// Sources can be embedded in the main spec as here or overridden in a build request.
	Sources map[string]Source `yaml:"sources,omitempty" json:"sources,omitempty"`

	// Patches is the list of patches to apply to the sources.
	// The map key is the name of the source to apply the patches to.
	// The value is the list of patches to apply to the source.
	// The patch must be present in the `Sources` map.
	// Each patch is applied in order and the result is used as the source for the build.
	Patches map[string][]PatchSpec `yaml:"patches,omitempty" json:"patches,omitempty"`

	// Build is the configuration for building the artifacts in the package.
	Build ArtifactBuild `yaml:"build,omitempty" json:"build,omitempty"`

	// Args is the list of arguments that can be used for shell-style expansion in (certain fields of) the spec.
	// Any arg supplied in the build request which does not appear in this list will cause an error.
	// Attempts to use an arg in the spec which is not specified here will assume to be a literal string.
	// The map value is the default value to use if the arg is not supplied in the build request.
	Args map[string]string `yaml:"args,omitempty" json:"args,omitempty"`

	// License is the license of the package.
	License string `yaml:"license" json:"license"`
	// Vendor is the vendor of the package.
	Vendor string `yaml:"vendor,omitempty" json:"vendor,omitempty"`
	// Packager is the name of the person,team,company that packaged the package.
	Packager string `yaml:"packager,omitempty" json:"packager,omitempty"`

	// Artifacts is the list of artifacts to include in the package.
	Artifacts Artifacts `yaml:"artifacts,omitempty" json:"artifacts,omitempty"`

	// The list of distro targets to build the package for.
	Targets map[string]Target `yaml:"targets,omitempty" json:"targets,omitempty"`

	// Dependencies are the different dependencies that need to be specified in the package.
	// Dependencies are overwritten if specified in the target map for the requested distro.
	Dependencies *PackageDependencies `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
	// PackageConfig is the configuration to use for artifact targets, such as
	// rpms, debs, or zip files containing Windows binaries
	PackageConfig *PackageConfig `yaml:"package_config,omitempty" json:"package_config,omitempty"`
	// Image is the image configuration when the target output is a container image.
	// This is overwritten if specified in the target map for the requested distro.
	Image *ImageConfig `yaml:"image,omitempty" json:"image,omitempty"`

	// Changelog is the list of changes to the package.
	Changelog []ChangelogEntry `yaml:"changelog,omitempty" json:"changelog,omitempty"`

	// Tests are the list of tests to run for the package that should work regardless of target OS
	// Each item in this list is run with a separate rootfs and cannot interact with other tests.
	// Each [TestSpec] is run with a separate rootfs, asynchronously from other [TestSpec].
	Tests []*TestSpec `yaml:"tests,omitempty" json:"tests,omitempty"`
	// contains filtered or unexported fields
}

Spec is the specification for a package build.

func LoadSpec

func LoadSpec(dt []byte) (*Spec, error)

LoadSpec loads a spec from the given data.

func LoadSpecWithSourceMap

func LoadSpecWithSourceMap(filename string, dt []byte) (*Spec, error)

LoadSpecWithSourceMap loads a spec from the given data and attaches source map information to the spec.

func (*Spec) CargohomeDeps

func (s *Spec) CargohomeDeps(sOpt SourceOpts, worker llb.State, opts ...llb.ConstraintsOpt) *llb.State

CargohomeDeps returns an llb.State containing all the Cargo dependencies for the spec for any sources that have a cargohome generator specified. If there are no sources with a cargohome generator, this will return a nil state.

func (*Spec) Ext

func (s *Spec) Ext(key string, target interface{}, opts ...func(*ExtDecodeConfig)) error

Ext reads the extension field from the spec and unmarshals it into the target value.

func (*Spec) FillDefaults

func (s *Spec) FillDefaults()

func (*Spec) GetArtifacts

func (s *Spec) GetArtifacts(targetKey string) Artifacts

func (*Spec) GetBuildRepos

func (s *Spec) GetBuildRepos(targetKey string) []PackageRepositoryConfig

func (*Spec) GetConflicts

func (s *Spec) GetConflicts(targetKey string) PackageDependencyList

func (*Spec) GetImageBases

func (s *Spec) GetImageBases(targetKey string) []BaseImage

func (*Spec) GetImagePost

func (s *Spec) GetImagePost(target string) *PostInstall

func (*Spec) GetInstallRepos

func (s *Spec) GetInstallRepos(targetKey string) []PackageRepositoryConfig

func (*Spec) GetPackageDeps

func (s *Spec) GetPackageDeps(target string) *PackageDependencies

GetPackageDeps returns the package dependencies for the given target. If the target does not have dependencies, the global dependencies are returned.

func (*Spec) GetProvides

func (s *Spec) GetProvides(targetKey string) PackageDependencyList

func (*Spec) GetReplaces

func (s *Spec) GetReplaces(targetKey string) PackageDependencyList

func (*Spec) GetSigner

func (s *Spec) GetSigner(targetKey string) (*PackageSigner, bool)

func (*Spec) GetSingleBase

func (s *Spec) GetSingleBase(targetKey string) (*BaseImage, error)

GetSingleBase looks up the base images to use for the targetKey and returns only the first entry. If there is more than 1 entry an error is returned. If there are no entries then both return values are nil.

func (*Spec) GetTestRepos

func (s *Spec) GetTestRepos(targetKey string) []PackageRepositoryConfig

func (*Spec) GomodDeps

func (s *Spec) GomodDeps(sOpt SourceOpts, worker llb.State, opts ...llb.ConstraintsOpt) *llb.State

GomodDeps returns an llb.State containing all the go module dependencies for the spec for any sources that have a gomod generator specified. If there are no sources with a gomod generator, this will return a nil state.

func (*Spec) HasCargohomes

func (s *Spec) HasCargohomes() bool

HasCargohomes returns true if any of the sources in the spec are a Rust Cargo project.

func (*Spec) HasGomods

func (s *Spec) HasGomods() bool

HasGomods returns true if any of the sources in the spec are a go module.

func (*Spec) HasNodeMods

func (s *Spec) HasNodeMods() bool

HasNodeMods returns true if any of the sources in the spec are node modules.

func (*Spec) HasPips

func (s *Spec) HasPips() bool

func (Spec) MarshalYAML

func (s Spec) MarshalYAML() ([]byte, error)

func (*Spec) NodeModDeps

func (s *Spec) NodeModDeps(sOpt SourceOpts, worker llb.State, opts ...llb.ConstraintsOpt) map[string]llb.State

NodeModDeps returns a map[string]llb.State containing all the node module dependencies for the spec for any sources that have a node module generator specified. If there are no sources with a node module generator, this will return nil. The returned states have node_modules installed for each relevant source, using sources as input.

func (*Spec) PipDeps

func (s *Spec) PipDeps(sOpt SourceOpts, worker llb.State, opts ...llb.ConstraintsOpt) *llb.State

PipDeps returns an llb.State containing all the pip dependencies for the spec for any sources that have a pip generator specified. If there are no sources with a pip generator, this will return nil. The returned state contains a merged cache of all downloaded pip packages.

func (*Spec) SubstituteArgs

func (s *Spec) SubstituteArgs(env map[string]string, opts ...SubstituteOpt) error

func (*Spec) UnmarshalYAML

func (s *Spec) UnmarshalYAML(ctx context.Context, node ast.Node) error

UnmarshalYAML implements the yaml.NodeUnmarshaler interface to provide custom unmarshalling.

func (Spec) Validate

func (s Spec) Validate() error

func (*Spec) WithExtension

func (s *Spec) WithExtension(key string, value interface{}) error

WithExtension adds an extension field to the spec. If the value is set to a []byte, it is used as-is and is expected to already be in YAML format.

type SubstituteConfig

type SubstituteConfig struct {
	AllowArg func(string) bool
}

type SubstituteOpt

type SubstituteOpt func(*SubstituteConfig)

SubstituteOpt is a functional option for SubstituteArgs

type SymlinkTarget

type SymlinkTarget struct {
	// Path is the path where the symlink should be placed
	//
	// Deprecated: This is here for backward compatibility. Use `Paths` instead.
	Path string `yaml:"path" json:"path" jsonschema:"oneof_required=path"`
	// Path is a list of `newpath`s that will all point to the same `oldpath`.
	Paths []string `yaml:"paths" json:"paths" jsonschema:"oneof_required=paths"`
	// User is the user name to set on the symlink.
	User string `yaml:"user,omitempty" json:"user,omitempty"`
	// Group is the group name to set on the symlink.
	Group string `yaml:"group,omitempty" json:"group,omitempty"`
}

SymlinkTarget specifies the properties of a symlink

type SystemdConfiguration

type SystemdConfiguration struct {
	// Units is a list of systemd units to include in the package.
	Units map[string]SystemdUnitConfig `yaml:"units,omitempty" json:"units,omitempty"`
	// Dropins is a list of systemd drop in files that should be included in the package
	Dropins map[string]SystemdDropinConfig `yaml:"dropins,omitempty" json:"dropins,omitempty"`
}

func (*SystemdConfiguration) EnabledUnits

func (s *SystemdConfiguration) EnabledUnits() map[string]SystemdUnitConfig

func (*SystemdConfiguration) GetDropins

func (s *SystemdConfiguration) GetDropins() map[string]SystemdDropinConfig

func (*SystemdConfiguration) GetUnits

func (s *SystemdConfiguration) GetUnits() map[string]SystemdUnitConfig

func (*SystemdConfiguration) IsEmpty

func (s *SystemdConfiguration) IsEmpty() bool

type SystemdDropinConfig

type SystemdDropinConfig struct {
	// Name is file or dir name to use for the artifact in the package.
	// If empty, the file or dir name from the produced artifact will be used.
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	// Unit is the name of the systemd unit that the dropin files should be copied under.
	Unit string `yaml:"unit" json:"unit"` // the unit named foo.service maps to the directory foo.service.d
}

func (SystemdDropinConfig) Artifact

func (s SystemdDropinConfig) Artifact() *ArtifactConfig

type SystemdUnitConfig

type SystemdUnitConfig struct {
	// Name is the name systemd unit should be copied under.
	// Nested paths are not supported. It is the user's responsibility
	// to name the service with the appropriate extension, i.e. .service, .timer, etc.
	Name string `yaml:"name" json:"name"`

	// Enable is used to enable the systemd unit on install
	// This determines what will be written to a systemd preset file
	Enable bool `yaml:"enable,omitempty" json:"enable,omitempty"`

	// Start can be optionally used to start the systemd unit on install
	// This determines what will be written to a systemd preset file
	// Note that depending on distribution there may be different
	// expectations as to if the package should be responsible for this
	Start bool `yaml:"start,omitempty" json:"start,omitempty"`
}

func (SystemdUnitConfig) Artifact

func (s SystemdUnitConfig) Artifact() *ArtifactConfig

func (SystemdUnitConfig) ResolveName

func (s SystemdUnitConfig) ResolveName(name string) string

func (SystemdUnitConfig) SplitName

func (s SystemdUnitConfig) SplitName(name string) (string, string)

Splitname resolves a unit name and then gives its unit base name. E.g. for `foo.socket` this would be `foo` and `socket`.

type Target

type Target struct {
	// Dependencies are the different dependencies that need to be specified in the package.
	Dependencies *PackageDependencies `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`

	// Image is the image configuration when the target output is a container image.
	Image *ImageConfig `yaml:"image,omitempty" json:"image,omitempty"`

	// Frontend is the frontend configuration to use for the target.
	// This is used to forward the build to a different, dalec-compatible frontend.
	// This can be useful when testing out new distros or using a different version of the frontend for a given distro.
	Frontend *Frontend `yaml:"frontend,omitempty" json:"frontend,omitempty"`

	// Tests are the list of tests to run which are specific to the target.
	// Tests are appended to the list of tests in the main [Spec]
	Tests []*TestSpec `yaml:"tests,omitempty" json:"tests,omitempty"`

	// PackageConfig is the configuration to use for artifact targets, such as
	// rpms, debs, or zip files containing Windows binaries
	PackageConfig *PackageConfig `yaml:"package_config,omitempty" json:"package_config,omitempty"`

	// Artifacts describes all of the artifact configurations to include for this specific target.
	Artifacts *Artifacts `yaml:"artifacts,omitempty" json:"artifacts,omitempty"`

	// Provides is the list of packages that this target provides.
	Provides PackageDependencyList `yaml:"provides,omitempty" json:"provides,omitempty"`

	// Replaces is the list of packages that this target replaces/obsoletes.
	Replaces PackageDependencyList `yaml:"replaces,omitempty" json:"replaces,omitempty"`

	// Conflicts is the list of packages that this target conflicts with.
	Conflicts PackageDependencyList `yaml:"conflicts,omitempty" json:"conflicts,omitempty"`
}

Target defines a distro-specific build target. This is used in Spec to specify the build target for a distro.

type TestSpec

type TestSpec struct {
	// Name is the name of the test
	// This will be used to output the test results
	Name string `yaml:"name" json:"name" jsonschema:"required"`

	// Dir is the working directory to run the command in.
	Dir string `yaml:"dir,omitempty" json:"dir,omitempty"`

	// Mounts is the list of sources to mount into the build steps.
	Mounts []SourceMount `yaml:"mounts,omitempty" json:"mounts,omitempty"`

	// Env is the list of environment variables to set for all commands in this step group.
	Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`

	// Steps is the list of commands to run to test the package.
	Steps []TestStep `yaml:"steps,omitempty" json:"steps,omitempty"`

	// Files is the list of files to check after running the steps.
	Files map[string]FileCheckOutput `yaml:"files,omitempty" json:"files,omitempty"`
	// contains filtered or unexported fields
}

TestSpec is used to execute tests against a container with the package installed in it.

func (*TestSpec) GetSourceLocation

func (t *TestSpec) GetSourceLocation(state llb.State) llb.ConstraintsOpt

GetSourceLocation returns an llb.ConstraintsOpt for the TestSpec

type TestStep

type TestStep struct {
	// Command is the command to run to build the artifact(s).
	// This will always be wrapped as /bin/sh -c "<command>", or whatever the equivalent is for the target distro.
	Command string `yaml:"command" json:"command" jsonschema:"required"`
	// Env is the list of environment variables to set for the command.
	Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`

	// Stdin is the input to provide to the command when running tests
	Stdin string `yaml:"stdin,omitempty" json:"stdin,omitempty"`
	// Stdout describes checks to perform against stdout
	Stdout CheckOutput `yaml:"stdout,omitempty" json:"stdout,omitempty"`
	// Stderr describes checks to perform against stderr
	Stderr CheckOutput `yaml:"stderr,omitempty" json:"stderr,omitempty"`
	// contains filtered or unexported fields
}

TestStep is a wrapper for BuildStep to include checks on stdio streams

func (*TestStep) GetSourceLocation

func (ts *TestStep) GetSourceLocation(state llb.State) llb.ConstraintsOpt

GetSourceLocation returns an llb.ConstraintsOpt for the TestStep

func (*TestStep) UnmarshalYAML

func (step *TestStep) UnmarshalYAML(ctx context.Context, node ast.Node) error

Jump to

Keyboard shortcuts

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