Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,006 changes: 1,006 additions & 0 deletions .github/workflows/ci-apple-container-mac.yml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ jobs:
uses: ./.github/workflows/ci-podman-ubuntu.yml
secrets: inherit

apple-container:
name: Apple Container
needs: fast-check
uses: ./.github/workflows/ci-apple-container-mac.yml
secrets: inherit

next:
name: Next
needs: fast-check
Expand Down
8 changes: 5 additions & 3 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,11 @@ func (b *Builder) startRegistryProxy(ctx context.Context, caps apicaps.CapSet) (
return nil, false
}

// Podman does not support the insecure localhost
if b.opt.ContainerFrontend.Scheme() == containerutil.SchemePodmanContainer {
cons.Printf("Registry proxy not supported on Podman. Falling back to tar-based outputs.")
// Podman and Apple Container do not support the insecure localhost registry proxy
scheme := b.opt.ContainerFrontend.Scheme()
if scheme == containerutil.SchemePodmanContainer ||
scheme == containerutil.SchemeAppleContainer {
cons.Printf("Registry proxy not supported on Podman/Apple Container. Falling back to tar-based outputs.")
return nil, false
}

Expand Down
53 changes: 48 additions & 5 deletions buildkitd/buildkitd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ func NewClient(

if errors.Is(retErr, os.ErrNotExist) {
switch fe.Config().Setting {
case containerutil.FrontendPodman, containerutil.FrontendPodmanShell:
case containerutil.FrontendPodman,
containerutil.FrontendPodmanShell,
containerutil.FrontendAppleContainer,
containerutil.FrontendAppleContainerShell:
tlsPaths := []string{
settings.TLSCA,
settings.ServerTLSKey,
Expand Down Expand Up @@ -127,8 +130,8 @@ func NewClient(

bkCons := console.WithPrefix("buildkitd")
if !isDockerAvailable(ctx, fe) {
bkCons.Printf("Is %[1]s installed and running? Are you part of any needed groups?\n", fe.Config().Binary)
return nil, fmt.Errorf("%s not available", fe.Config().Binary)
bkCons.Printf("Is %[1]s installed and running? Are you part of any needed groups?\n", frontendDisplayName(fe))
return nil, fmt.Errorf("%s not available", frontendDisplayName(fe))
}

info, workerInfo, err := maybeStart(ctx, console, image, containerName, installationName, fe, settings, opts...)
Expand Down Expand Up @@ -267,7 +270,7 @@ func maybeStart(
if isStarted {
console.
WithPrefix("buildkitd").
Printf("Found buildkit daemon as %s container (%s)\n", fe.Config().Binary, containerName)
Printf("Found buildkit daemon as %s (%s)\n", frontendContainerDesc(fe), containerName)

var (
info *client.Info
Expand All @@ -284,7 +287,7 @@ func maybeStart(

console.
WithPrefix("buildkitd").
Printf("Starting buildkit daemon as a %s container (%s)...\n", fe.Config().Binary, containerName)
Printf("Starting buildkit daemon as %s (%s)...\n", frontendContainerDescWithArticle(fe), containerName)

err = Start(ctx, console, image, containerName, installationName, fe, settings, false)
if err != nil {
Expand Down Expand Up @@ -1317,3 +1320,43 @@ func humanizeBytes(v int64) string {

return humanize.Bytes(bytes)
}

func frontendDisplayName(fe containerutil.ContainerFrontend) string {
switch fe.Config().Setting {
case containerutil.FrontendAppleContainer, containerutil.FrontendAppleContainerShell:
return "Apple Container"
case containerutil.FrontendPodman, containerutil.FrontendPodmanShell:
return "Podman"
case containerutil.FrontendDocker, containerutil.FrontendDockerShell:
return "Docker"
default:
return fe.Config().Binary
}
}

func frontendContainerDesc(fe containerutil.ContainerFrontend) string {
switch fe.Config().Setting {
case containerutil.FrontendAppleContainer, containerutil.FrontendAppleContainerShell:
return "Apple Container"
case containerutil.FrontendPodman, containerutil.FrontendPodmanShell:
return "Podman container"
default:
return fe.Config().Binary + " container"
}
}

func frontendContainerDescWithArticle(fe containerutil.ContainerFrontend) string {
switch fe.Config().Setting {
case containerutil.FrontendAppleContainer, containerutil.FrontendAppleContainerShell:
return "an Apple Container"
case containerutil.FrontendPodman, containerutil.FrontendPodmanShell:
return "a Podman container"
default:
desc := fe.Config().Binary + " container"
if len(desc) > 0 && (desc[0] == 'a' || desc[0] == 'e' || desc[0] == 'i' || desc[0] == 'o' || desc[0] == 'u') {
return "an " + desc
}

return "a " + desc
}
}
2 changes: 1 addition & 1 deletion cmd/earthly/app/before.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (app *EarthApp) parseFrontend(ctx context.Context) error {
app.BaseCLI.Flags().ContainerFrontend = stub

if !app.BaseCLI.Flags().Verbose {
console.Printf("Unable to detect Docker or Podman. Use --verbose to see details (or errors)\n")
console.Printf("Unable to detect Docker, Podman, or Apple Container. Use --verbose to see details (or errors)\n")
}

console.VerbosePrintf("%s frontend initialization failed due to %s",
Expand Down
54 changes: 27 additions & 27 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,33 @@ var (

// GlobalConfig contains global config values.
type GlobalConfig struct {
DarwinProxyImage string `help:"The container image & tag used for the Docker Desktop registry proxy." yaml:"darwin_proxy_image"` //nolint:lll
ServerTLSKey string `help:"The path to the server key for verification. Relative paths are interpreted as relative to the config path. Only used when earth manages buildkit." yaml:"buildkitd_tlskey"` //nolint:lll
BuildkitScheme string `help:" *Deprecated* Change how earth communicates with its buildkit daemon. Valid options are: docker-container, tcp. TCP is experimental." yaml:"buildkit_transport"` //nolint:lll
BuildkitImage string `help:"Choose a specific image for your buildkitd." yaml:"buildkit_image"` //nolint:lll
CachePath string `help:" *Deprecated* The path to keep earth's cache." yaml:"cache_path"` //nolint:lll
SecretProvider string `help:"Command to execute to retrieve secret." yaml:"secret_provider"` //nolint:lll
BuildkitAdditionalConfig string `help:"Additional config to use when starting the buildkit container; like using custom/self-signed certificates." yaml:"buildkit_additional_config"` //nolint:lll
IPTables string `help:"Which iptables binary to use. Valid values are iptables-legacy or iptables-nft. Bypasses any autodetection." yaml:"ip_tables"` //nolint:lll
ContainerFrontend string `help:"What program should be used to start and stop buildkitd, save images. Default is 'docker'. Valid options are 'docker' and 'podman' (experimental)." yaml:"container_frontend"` //nolint:lll
ServerTLSCert string `help:"The path to the server cert for verification. Relative paths are interpreted as relative to the config path. Only used when earth manages buildkit." yaml:"buildkitd_tlscert"` //nolint:lll
BuildkitHost string `help:"The URL of your buildkit, remote or local." yaml:"buildkit_host"` //nolint:lll
TLSCACert string `help:"The path to the CA cert for verification. Relative paths are interpreted as relative to the config path." yaml:"tlsca"` //nolint:lll
ClientTLSKey string `help:"The path to the client key for verification. Relative paths are interpreted as relative to the config path." yaml:"tlskey"` //nolint:lll
GitImage string `help:"Image used to resolve git repositories" yaml:"git_image"` //nolint:lll
LocalRegistryHost string `help:"The URL of the local registry used for image exports to Docker." yaml:"local_registry_host"` //nolint:lll
TLSCAKey string `help:"The path to the CA key for generating any missing certificates. Relative paths are interpreted as relative to the config path." yaml:"tlsca_key"` //nolint:lll
ClientTLSCert string `help:"The path to the client cert for verification. Relative paths are interpreted as relative to the config path." yaml:"tlscert"` //nolint:lll
BuildkitAdditionalArgs []string `help:"Additional args to pass to buildkit when it starts. Useful for custom/self-signed certs, or user namespace complications." yaml:"buildkit_additional_args"` //nolint:lll
BuildkitCacheSizePct int `help:"Size of the buildkit cache, as percentage (0-100)." yaml:"cache_size_pct"` //nolint:lll
BuildkitCacheSizeMb int `help:"Size of the buildkit cache in Megabytes." yaml:"cache_size_mb"` //nolint:lll
ConversionParallelism int `help:"Set the conversion parallelism for speeding up the use of IF, WITH, DOCKER --load, FROMDOCKERFILE and others. A value of 0 disables the feature" yaml:"conversion_parallelism"` //nolint:lll
BuildkitMaxParallelism int `help:"Max parallelism for buildkit workers" yaml:"buildkit_max_parallelism"` //nolint:lll
DarwinProxyWait time.Duration `help:"The maximum time to wait for the Darwin registry proxy support container to become available." yaml:"darwin_proxy_wait"` //nolint:lll
BuildkitRestartTimeoutS int `help:"How long to wait for buildkit to (re)start, in seconds." yaml:"buildkit_restart_timeout_s"` //nolint:lll
BuildkitCacheKeepDurationS int `help:"Max age of cache, in seconds. 0 disables age-based cache expiry." yaml:"buildkit_cache_keep_duration_s"` //nolint:lll
CniMtu uint16 `help:"Override auto-detection of the default interface MTU, for all containers within buildkit" yaml:"cni_mtu"` //nolint:lll
TLSEnabled bool `help:"If TLS should be used to communicate with Buildkit. Only honored when BuildkitScheme is 'tcp'." yaml:"tls_enabled"` //nolint:lll
DarwinProxyImage string `help:"The container image & tag used for the Docker Desktop registry proxy." yaml:"darwin_proxy_image"` //nolint:lll
ServerTLSKey string `help:"The path to the server key for verification. Relative paths are interpreted as relative to the config path. Only used when earth manages buildkit." yaml:"buildkitd_tlskey"` //nolint:lll
BuildkitScheme string `help:" *Deprecated* Change how earth communicates with its buildkit daemon. Valid options are: docker-container, tcp. TCP is experimental." yaml:"buildkit_transport"` //nolint:lll
BuildkitImage string `help:"Choose a specific image for your buildkitd." yaml:"buildkit_image"` //nolint:lll
CachePath string `help:" *Deprecated* The path to keep earth's cache." yaml:"cache_path"` //nolint:lll
SecretProvider string `help:"Command to execute to retrieve secret." yaml:"secret_provider"` //nolint:lll
BuildkitAdditionalConfig string `help:"Additional config to use when starting the buildkit container; like using custom/self-signed certificates." yaml:"buildkit_additional_config"` //nolint:lll
IPTables string `help:"Which iptables binary to use. Valid values are iptables-legacy or iptables-nft. Bypasses any autodetection." yaml:"ip_tables"` //nolint:lll
ContainerFrontend string `help:"What program should be used to start and stop buildkitd, save images. Default is 'docker'. Valid options are 'docker', 'podman' (experimental), and 'apple-container' (experimental)." yaml:"container_frontend"` //nolint:lll
ServerTLSCert string `help:"The path to the server cert for verification. Relative paths are interpreted as relative to the config path. Only used when earth manages buildkit." yaml:"buildkitd_tlscert"` //nolint:lll
BuildkitHost string `help:"The URL of your buildkit, remote or local." yaml:"buildkit_host"` //nolint:lll
TLSCACert string `help:"The path to the CA cert for verification. Relative paths are interpreted as relative to the config path." yaml:"tlsca"` //nolint:lll
ClientTLSKey string `help:"The path to the client key for verification. Relative paths are interpreted as relative to the config path." yaml:"tlskey"` //nolint:lll
GitImage string `help:"Image used to resolve git repositories" yaml:"git_image"` //nolint:lll
LocalRegistryHost string `help:"The URL of the local registry used for image exports to Docker." yaml:"local_registry_host"` //nolint:lll
TLSCAKey string `help:"The path to the CA key for generating any missing certificates. Relative paths are interpreted as relative to the config path." yaml:"tlsca_key"` //nolint:lll
ClientTLSCert string `help:"The path to the client cert for verification. Relative paths are interpreted as relative to the config path." yaml:"tlscert"` //nolint:lll
BuildkitAdditionalArgs []string `help:"Additional args to pass to buildkit when it starts. Useful for custom/self-signed certs, or user namespace complications." yaml:"buildkit_additional_args"` //nolint:lll
BuildkitCacheSizePct int `help:"Size of the buildkit cache, as percentage (0-100)." yaml:"cache_size_pct"` //nolint:lll
BuildkitCacheSizeMb int `help:"Size of the buildkit cache in Megabytes." yaml:"cache_size_mb"` //nolint:lll
ConversionParallelism int `help:"Set the conversion parallelism for speeding up the use of IF, WITH, DOCKER --load, FROMDOCKERFILE and others. A value of 0 disables the feature" yaml:"conversion_parallelism"` //nolint:lll
BuildkitMaxParallelism int `help:"Max parallelism for buildkit workers" yaml:"buildkit_max_parallelism"` //nolint:lll
DarwinProxyWait time.Duration `help:"The maximum time to wait for the Darwin registry proxy support container to become available." yaml:"darwin_proxy_wait"` //nolint:lll
BuildkitRestartTimeoutS int `help:"How long to wait for buildkit to (re)start, in seconds." yaml:"buildkit_restart_timeout_s"` //nolint:lll
BuildkitCacheKeepDurationS int `help:"Max age of cache, in seconds. 0 disables age-based cache expiry." yaml:"buildkit_cache_keep_duration_s"` //nolint:lll
CniMtu uint16 `help:"Override auto-detection of the default interface MTU, for all containers within buildkit" yaml:"cni_mtu"` //nolint:lll
TLSEnabled bool `help:"If TLS should be used to communicate with Buildkit. Only honored when BuildkitScheme is 'tcp'." yaml:"tls_enabled"` //nolint:lll
}

// GitConfig contains git-specific config values.
Expand Down
Loading
Loading