mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
protobuf: remove gogoproto
Removes gogo/protobuf from buildx and updates to a version of moby/buildkit where gogo is removed. This also changes how the proto files are generated. This is because newer versions of protobuf are more strict about name conflicts. If two files have the same name (even if they are relative paths) and are used in different protoc commands, they'll conflict in the registry. Since protobuf file generation doesn't work very well with `paths=source_relative`, this removes the `go:generate` expression and just relies on the dockerfile to perform the generation. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
27
vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go
generated
vendored
27
vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go
generated
vendored
@ -154,10 +154,29 @@ type ContainerdRuntime struct {
|
||||
}
|
||||
|
||||
type GCPolicy struct {
|
||||
All bool `toml:"all"`
|
||||
KeepBytes DiskSpace `toml:"keepBytes"`
|
||||
KeepDuration Duration `toml:"keepDuration"`
|
||||
Filters []string `toml:"filters"`
|
||||
All bool `toml:"all"`
|
||||
Filters []string `toml:"filters"`
|
||||
|
||||
KeepDuration Duration `toml:"keepDuration"`
|
||||
|
||||
// KeepBytes is the maximum amount of storage this policy is ever allowed
|
||||
// to consume. Any storage above this mark can be cleared during a gc
|
||||
// sweep.
|
||||
//
|
||||
// Deprecated: use MaxStorage instead
|
||||
KeepBytes DiskSpace `toml:"keepBytes"`
|
||||
|
||||
// MinStorage is the minimum amount of storage this policy is always
|
||||
// allowed to consume. Any amount of storage below this mark will not be
|
||||
// cleared by this policy.
|
||||
MinStorage DiskSpace `toml:"minStorage"`
|
||||
// MaxStorage is the maximum amount of storage this policy is ever allowed
|
||||
// to consume. Any storage above this mark can be cleared during a gc
|
||||
// sweep.
|
||||
MaxStorage DiskSpace `toml:"maxStorage"`
|
||||
// Free is the amount of storage the gc will attempt to leave free on the
|
||||
// disk. However, it will never attempt to bring it below MinStorage.
|
||||
Free DiskSpace `toml:"free"`
|
||||
}
|
||||
|
||||
type DNSConfig struct {
|
||||
|
15
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy.go
generated
vendored
15
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/disk"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@ -77,21 +78,21 @@ func DefaultGCPolicy(keep DiskSpace) []GCPolicy {
|
||||
{
|
||||
Filters: []string{"type==source.local,type==exec.cachemount,type==source.git.checkout"},
|
||||
KeepDuration: Duration{Duration: time.Duration(48) * time.Hour}, // 48h
|
||||
KeepBytes: DiskSpace{Bytes: 512 * 1e6}, // 512MB
|
||||
MaxStorage: DiskSpace{Bytes: 512 * 1e6}, // 512MB
|
||||
},
|
||||
// remove any data not used for 60 days
|
||||
{
|
||||
KeepDuration: Duration{Duration: time.Duration(60) * 24 * time.Hour}, // 60d
|
||||
KeepBytes: keep,
|
||||
MaxStorage: keep,
|
||||
},
|
||||
// keep the unshared build cache under cap
|
||||
{
|
||||
KeepBytes: keep,
|
||||
MaxStorage: keep,
|
||||
},
|
||||
// if previous policies were insufficient start deleting internal data to keep build cache under cap
|
||||
{
|
||||
All: true,
|
||||
KeepBytes: keep,
|
||||
All: true,
|
||||
MaxStorage: keep,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -118,12 +119,12 @@ func (d DiskSpace) AsBytes(root string) int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
diskSize, err := getDiskSize(root)
|
||||
dstat, err := disk.GetDiskStat(root)
|
||||
if err != nil {
|
||||
bklog.L.Warnf("failed to get disk size: %v", err)
|
||||
return defaultCap
|
||||
}
|
||||
avail := diskSize * d.Percentage / 100
|
||||
avail := dstat.Total * d.Percentage / 100
|
||||
rounded := (avail/(1<<30) + 1) * 1e9 // round up
|
||||
return rounded
|
||||
}
|
||||
|
19
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_openbsd.go
generated
vendored
19
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_openbsd.go
generated
vendored
@ -1,19 +0,0 @@
|
||||
//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
|
||||
}
|
17
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_unix.go
generated
vendored
17
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_unix.go
generated
vendored
@ -1,19 +1,6 @@
|
||||
//go:build !windows && !openbsd
|
||||
// +build !windows,!openbsd
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
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.Bsize) * int64(st.Blocks)
|
||||
return diskSize, nil
|
||||
}
|
||||
|
23
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_windows.go
generated
vendored
23
vendor/github.com/moby/buildkit/cmd/buildkitd/config/gcpolicy_windows.go
generated
vendored
@ -3,29 +3,6 @@
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
Reference in New Issue
Block a user