buildkitd

package
v0.6.29 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MPL-2.0 Imports: 33 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 GenerateCertificates added in v0.6.15

func GenerateCertificates(dir string) error

GenerateCertificates 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 added in v0.3.13

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

GetContainerIP returns the IP of the buildkit container.

func GetContainerImageID

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

GetContainerImageID fetches the ID of the image used for the running buildkitd container.

func GetDockerVersion added in v0.6.15

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

GetDockerVersion returns the docker version command output

func GetLogs added in v0.6.15

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 added in v0.6.15

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

func MaybeRestart

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

MaybeRestart checks whether the there is a different buildkitd image available locally or if settings of the current container are different from the provided settings. In either case, the container is restarted.

func MaybeStart

func MaybeStart(ctx context.Context, console conslogging.ConsoleLogger, image, containerName string, fe containerutil.ContainerFrontend, settings Settings, opts ...client.ClientOpt) (cinfo *client.Info, winfo *client.WorkerInfo, finalErr error)

MaybeStart ensures that the buildkitd daemon is started. It returns the URL that can be used to connect to it.

func NewClient

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

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

func PrintSatelliteInfo added in v0.6.20

func PrintSatelliteInfo(ctx context.Context, console conslogging.ConsoleLogger, earthlyVersion string, settings Settings) error

PrintSatelliteInfo prints the instance's details, including its Buildkit version, current workload, and garbage collection.

func RemoveExited added in v0.3.0

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 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 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, address string, opTimeout time.Duration, 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 {
	CacheSizeMb          int
	CacheSizePct         int
	Debug                bool
	BuildkitAddress      string
	DebuggerAddress      string
	LocalRegistryAddress string
	AdditionalArgs       []string
	AdditionalConfig     string
	CniMtu               uint16
	Timeout              time.Duration `hash:"ignore"`
	TLSCA                string
	ClientTLSCert        string
	ClientTLSKey         string
	ServerTLSCert        string
	ServerTLSKey         string
	UseTCP               bool
	UseTLS               bool
	VolumeName           string
	IPTables             string
	MaxParallelism       int
	SatelliteName        string `hash:"ignore"`
	SatelliteOrgID       string `hash:"ignore"`
	SatelliteToken       string `hash:"ignore"`
	EnableProfiler       bool
	NoUpdate             bool   `hash:"ignore"`
	StartUpLockPath      string `hash:"ignore"`
}

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

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