vendor: update buildkit to v0.14.0-rc1

Update buildkit dependency to v0.14.0-rc1. Update the tracing
infrastructure to use the new detect API which updates how the delegated
exporter is configured.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
Jonathan A. Sternberg
2024-05-31 16:11:33 -05:00
parent 9b6c4103af
commit b1cb658a31
80 changed files with 2583 additions and 1597 deletions

View File

@ -33,6 +33,19 @@ type Config struct {
DNS *DNSConfig `toml:"dns"`
History *HistoryConfig `toml:"history"`
Frontends struct {
Dockerfile DockerfileFrontendConfig `toml:"dockerfile.v0"`
Gateway GatewayFrontendConfig `toml:"gateway.v0"`
} `toml:"frontend"`
System *SystemConfig `toml:"system"`
}
type SystemConfig struct {
// PlatformCacheMaxAge controls how often supported platforms
// are refreshed by rescanning the system.
PlatformsCacheMaxAge *Duration `toml:"platformsCacheMaxAge"`
}
type LogConfig struct {
@ -40,10 +53,11 @@ type LogConfig struct {
}
type GRPCConfig struct {
Address []string `toml:"address"`
DebugAddress string `toml:"debugAddress"`
UID *int `toml:"uid"`
GID *int `toml:"gid"`
Address []string `toml:"address"`
DebugAddress string `toml:"debugAddress"`
UID *int `toml:"uid"`
GID *int `toml:"gid"`
SecurityDescriptor string `toml:"securityDescriptor"`
TLS TLSConfig `toml:"tls"`
// MaxRecvMsgSize int `toml:"max_recv_message_size"`
@ -154,3 +168,12 @@ type HistoryConfig struct {
MaxAge Duration `toml:"maxAge"`
MaxEntries int64 `toml:"maxEntries"`
}
type DockerfileFrontendConfig struct {
Enabled *bool `toml:"enabled"`
}
type GatewayFrontendConfig struct {
Enabled *bool `toml:"enabled"`
AllowedRepositories []string `toml:"allowedRepositories"`
}

View File

@ -7,6 +7,7 @@ import (
"time"
"github.com/docker/go-units"
"github.com/moby/buildkit/util/bklog"
"github.com/pkg/errors"
)
@ -104,3 +105,25 @@ func stripQuotes(s string) string {
}
return s
}
func DetectDefaultGCCap() DiskSpace {
return DiskSpace{Percentage: DiskSpacePercentage}
}
func (d DiskSpace) AsBytes(root string) int64 {
if d.Bytes != 0 {
return d.Bytes
}
if d.Percentage == 0 {
return 0
}
diskSize, err := getDiskSize(root)
if err != nil {
bklog.L.Warnf("failed to get disk size: %v", err)
return defaultCap
}
avail := diskSize * d.Percentage / 100
rounded := (avail/(1<<30) + 1) * 1e9 // round up
return rounded
}

View File

@ -0,0 +1,19 @@
//go:build openbsd
// +build openbsd
package config
import (
"syscall"
)
var DiskSpacePercentage int64 = 10
func getDiskSize(root string) (int64, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return 0, err
}
diskSize := int64(st.F_bsize) * int64(st.F_blocks)
return diskSize, nil
}

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build !windows && !openbsd
// +build !windows,!openbsd
package config
@ -7,23 +7,13 @@ import (
"syscall"
)
func DetectDefaultGCCap() DiskSpace {
return DiskSpace{Percentage: 10}
}
func (d DiskSpace) AsBytes(root string) int64 {
if d.Bytes != 0 {
return d.Bytes
}
if d.Percentage == 0 {
return 0
}
var DiskSpacePercentage int64 = 10
func getDiskSize(root string) (int64, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return defaultCap
return 0, err
}
diskSize := int64(st.Bsize) * int64(st.Blocks)
avail := diskSize * d.Percentage / 100
return (avail/(1<<30) + 1) * 1e9 // round up
return diskSize, nil
}

View File

@ -3,10 +3,29 @@
package config
func DetectDefaultGCCap() DiskSpace {
return DiskSpace{Bytes: defaultCap}
}
import (
"golang.org/x/sys/windows"
)
func (d DiskSpace) AsBytes(root string) int64 {
return d.Bytes
// set as double that for Linux since
// Windows images are generally larger.
var DiskSpacePercentage int64 = 20
func getDiskSize(root string) (int64, error) {
rootUTF16, err := windows.UTF16FromString(root)
if err != nil {
return 0, err
}
var freeAvailableBytes uint64
var totalBytes uint64
var totalFreeBytes uint64
if err := windows.GetDiskFreeSpaceEx(
&rootUTF16[0],
&freeAvailableBytes,
&totalBytes,
&totalFreeBytes); err != nil {
return 0, err
}
return int64(totalBytes), nil
}