buildkitd

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBuildkitCrashed is an error returned when buildkit has terminated unexpectedly.
	ErrBuildkitCrashed = errors.New("buildkitd crashed")

	// ErrBuildkitConnectionFailure is an error returned when buildkit has failed to respond.
	ErrBuildkitConnectionFailure = errors.New("buildkitd did not respond (in time)")
)

Functions

func GenCerts

func GenCerts(cfg config.Config, hostname string) error

GenCerts creates and saves a CA and certificates for both sides of an mTLS TCP connection.

func GetAvailableImageID

func GetAvailableImageID(ctx context.Context, image string, fe containerutil.ContainerFrontend) (string, error)

GetAvailableImageID fetches the ID of the image buildkitd image available.

func GetContainerIP

func GetContainerIP(
	ctx context.Context, containerName string, fe containerutil.ContainerFrontend, settings Settings,
) (string, error)

GetContainerIP returns the IP of the buildkit container.

func GetContainerInfo

func GetContainerInfo(
	ctx context.Context, containerName string, fe containerutil.ContainerFrontend,
) (*containerutil.ContainerInfo, error)

GetContainerInfo inspects the running container (running under containerName).

func GetDockerVersion

func GetDockerVersion(ctx context.Context, fe containerutil.ContainerFrontend) (string, error)

GetDockerVersion returns the docker version command output.

func GetImageInfo

GetImageInfo inspects an image.

func GetLogs

func GetLogs(
	ctx context.Context, containerName string, fe containerutil.ContainerFrontend, settings Settings,
) (string, error)

GetLogs returns earthly-buildkitd logs.

func GetSettingsHash

func GetSettingsHash(ctx context.Context, containerName string, fe containerutil.ContainerFrontend) (string, error)

GetSettingsHash fetches the hash of the currently running buildkitd container.

func IsStarted

func IsStarted(ctx context.Context, containerName string, fe containerutil.ContainerFrontend) (bool, error)

IsStarted checks if the buildkitd container has been started.

func MaybePull

MaybePull checks whether an image is available locally and pulls it if it is not.

func NewClient

func NewClient(
	ctx context.Context,
	console conslogging.ConsoleLogger,
	image, containerName, installationName string,
	fe containerutil.ContainerFrontend,
	earthlyVersion string,
	settings Settings,
	opts ...client.ClientOpt,
) (_ *client.Client, retErr error)

NewClient returns a new buildkitd client. If the buildkitd daemon is local, this function might start one up, if not already started.

func RemoveExited

func RemoveExited(ctx context.Context, fe containerutil.ContainerFrontend, containerName string) error

RemoveExited removes any stopped or exited buildkitd containers.

func ResetCache

func ResetCache(
	ctx context.Context,
	console conslogging.ConsoleLogger,
	image, containerName, installationName string,
	fe containerutil.ContainerFrontend,
	settings Settings,
	opts ...client.ClientOpt,
) error

ResetCache restarts the buildkitd daemon with the reset command.

func Start

func Start(
	ctx context.Context,
	console conslogging.ConsoleLogger,
	image, containerName, installationName string,
	fe containerutil.ContainerFrontend,
	settings Settings,
	reset bool,
) error

Start starts the buildkitd daemon.

func Stop

func Stop(ctx context.Context, containerName string, fe containerutil.ContainerFrontend) error

Stop stops the buildkitd container.

func WaitUntilStarted

func WaitUntilStarted(
	ctx context.Context,
	console conslogging.ConsoleLogger,
	containerName, volumeName string,
	settings Settings,
	fe containerutil.ContainerFrontend,
	opts ...client.ClientOpt,
) (*client.Info, *client.WorkerInfo, error)

WaitUntilStarted waits until the buildkitd daemon has started and is healthy.

func WaitUntilStopped

func WaitUntilStopped(
	ctx context.Context, containerName string, opTimeout time.Duration, fe containerutil.ContainerFrontend,
) error

WaitUntilStopped waits until the buildkitd daemon has stopped.

Types

type Settings

type Settings struct {
	TLSCA                string
	ServerTLSCert        string
	IPTables             string
	StartUpLockPath      string `hash:"ignore"`
	BuildkitAddress      string
	LocalRegistryAddress string
	ServerTLSKey         string
	ClientTLSKey         string
	ClientTLSCert        string
	VolumeName           string
	AdditionalConfig     string
	AdditionalArgs       []string
	CacheSizeMb          int
	CacheSizePct         int
	Timeout              time.Duration `hash:"ignore"`
	MaxParallelism       int
	CacheKeepDuration    int
	CniMtu               uint16
	UseTLS               bool
	UseTCP               bool
	EnableProfiler       bool
	NoUpdate             bool `hash:"ignore"`
	Debug                bool
}

Settings represents the buildkitd settings used to start up the daemon with.

func (Settings) HasConfiguredCacheSize

func (s Settings) HasConfiguredCacheSize() bool

HasConfiguredCacheSize returns if the buildkitd cache size was configured.

func (Settings) Hash

func (s Settings) Hash() (string, error)

Hash returns a secure hash of the settings.

func (Settings) VerifyHash

func (s Settings) VerifyHash(hash string) (bool, error)

VerifyHash checks whether a given hash matches the settings.

Jump to

Keyboard shortcuts

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