package confutil

import "github.com/docker/buildx/util/confutil"

Index

Constants

const (
	// DefaultBuildKitStateDir and DefaultBuildKitConfigDir are the location
	// where buildkitd inside the container stores its state. Some drivers
	// create a Linux container, so this should match the location for Linux,
	// as defined in: https://github.com/moby/buildkit/blob/v0.9.0/util/appdefaults/appdefaults_unix.go#L11-L15
	DefaultBuildKitStateDir  = "/var/lib/buildkit"
	DefaultBuildKitConfigDir = "/etc/buildkit"
)

Functions

func IsExperimental

func IsExperimental() bool

IsExperimental checks if the experimental flag has been configured.

func LoadConfigFiles

func LoadConfigFiles(bkconfig string) (map[string][]byte, error)

LoadConfigFiles creates a temp directory with BuildKit config and registry certificates ready to be copied to a container.

func LoadConfigTree

func LoadConfigTree(fp string) (*toml.Tree, error)

LoadConfigTree loads BuildKit config toml tree

func MetadataWarningsEnabled

func MetadataWarningsEnabled() bool

MetadataWarningsEnabled returns whether metadata warnings are enabled from BUILDX_METADATA_WARNINGS environment variable (default false)

Types

type Config

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

func NewConfig

func NewConfig(dockerCli command.Cli, opts ...ConfigOption) *Config

func (*Config) AtomicWriteFile

func (c *Config) AtomicWriteFile(filename string, data []byte, perm os.FileMode) error

AtomicWriteFile writes data to a file within the config dir atomically

func (*Config) BuildKitConfigFile

func (c *Config) BuildKitConfigFile() (string, bool)

BuildKitConfigFile returns the default BuildKit configuration file path

func (*Config) Dir

func (c *Config) Dir() string

Dir will look for correct configuration store path; if `$BUILDX_CONFIG` is set - use it, otherwise use parent directory of Docker config file (i.e. `${DOCKER_CONFIG}/buildx`)

func (*Config) MkdirAll

func (c *Config) MkdirAll(dir string, perm os.FileMode) error

MkdirAll creates a directory and all necessary parents within the config dir.

func (*Config) TryNodeIdentifier

func (c *Config) TryNodeIdentifier() (out string)

type ConfigOption

type ConfigOption func(*configOptions)

func WithDir

func WithDir(dir string) ConfigOption

type MetadataProvenanceMode

type MetadataProvenanceMode string

MetadataProvenanceMode is the type for setting provenance in the metadata file

const (
	// MetadataProvenanceModeMin sets minimal provenance (default)
	MetadataProvenanceModeMin MetadataProvenanceMode = "min"
	// MetadataProvenanceModeMax sets full provenance
	MetadataProvenanceModeMax MetadataProvenanceMode = "max"
	// MetadataProvenanceModeDisabled doesn't set provenance
	MetadataProvenanceModeDisabled MetadataProvenanceMode = "disabled"
)

func MetadataProvenance

func MetadataProvenance() MetadataProvenanceMode

MetadataProvenance returns the metadata provenance mode from BUILDX_METADATA_PROVENANCE environment variable

func ParseMetadataProvenance

func ParseMetadataProvenance(inp string) MetadataProvenanceMode

ParseMetadataProvenance parses the metadata provenance mode from a string

Source Files

config.go config_unix.go container.go exp.go metadata.go

Version
v0.22.0 (latest)
Published
Mar 17, 2025
Platform
js/wasm
Imports
19 packages
Last checked
3 weeks ago

Tools for package owners.