Move config under worker config. Add new integration test to GHA matrix.

Signed-off-by: Vlad A. Ionescu <vladaionescu@users.noreply.github.com>
v0.9
Vlad A. Ionescu 2021-05-13 14:55:36 +03:00
parent b3cf7c43cf
commit 60d38f972c
5 changed files with 12 additions and 7 deletions

View File

@ -90,6 +90,9 @@ jobs:
- -
pkg: ./cmd/buildctl ./worker/containerd pkg: ./cmd/buildctl ./worker/containerd
typ: integration typ: integration
-
pkg: ./solver
typ: integration
- -
pkg: '' pkg: ''
skip-integration-tests: 1 skip-integration-tests: 1

View File

@ -22,8 +22,6 @@ type Config struct {
Registries map[string]RegistryConfig `toml:"registry"` Registries map[string]RegistryConfig `toml:"registry"`
DNS *DNSConfig `toml:"dns"` DNS *DNSConfig `toml:"dns"`
MaxParallelism int `toml:"max-parallelism"`
} }
type GRPCConfig struct { type GRPCConfig struct {
@ -93,6 +91,8 @@ type OCIConfig struct {
// ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers. // ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers.
// The profile should already be loaded (by a higher level system) before creating a worker. // The profile should already be loaded (by a higher level system) before creating a worker.
ApparmorProfile string `toml:"apparmor-profile"` ApparmorProfile string `toml:"apparmor-profile"`
MaxParallelism int `toml:"max-parallelism"`
} }
type ContainerdConfig struct { type ContainerdConfig struct {
@ -108,6 +108,8 @@ type ContainerdConfig struct {
// ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers. // ApparmorProfile is the name of the apparmor profile that should be used to constrain build containers.
// The profile should already be loaded (by a higher level system) before creating a worker. // The profile should already be loaded (by a higher level system) before creating a worker.
ApparmorProfile string `toml:"apparmor-profile"` ApparmorProfile string `toml:"apparmor-profile"`
MaxParallelism int `toml:"max-parallelism"`
} }
type GCPolicy struct { type GCPolicy struct {

View File

@ -227,8 +227,8 @@ func containerdWorkerInitializer(c *cli.Context, common workerInitializerOpt) ([
} }
var parallelismSem *semaphore.Weighted var parallelismSem *semaphore.Weighted
if common.config.MaxParallelism > 0 { if cfg.MaxParallelism > 0 {
parallelismSem = semaphore.NewWeighted(int64(common.config.MaxParallelism)) parallelismSem = semaphore.NewWeighted(int64(cfg.MaxParallelism))
} }
snapshotter := ctd.DefaultSnapshotter snapshotter := ctd.DefaultSnapshotter

View File

@ -278,8 +278,8 @@ func ociWorkerInitializer(c *cli.Context, common workerInitializerOpt) ([]worker
} }
var parallelismSem *semaphore.Weighted var parallelismSem *semaphore.Weighted
if common.config.MaxParallelism > 0 { if cfg.MaxParallelism > 0 {
parallelismSem = semaphore.NewWeighted(int64(common.config.MaxParallelism)) parallelismSem = semaphore.NewWeighted(int64(cfg.MaxParallelism))
} }
opt, err := runc.NewWorkerOpt(common.config.Root, snFactory, cfg.Rootless, processMode, cfg.Labels, idmapping, nc, dns, cfg.Binary, cfg.ApparmorProfile, parallelismSem) opt, err := runc.NewWorkerOpt(common.config.Root, snFactory, cfg.Rootless, processMode, cfg.Labels, idmapping, nc, dns, cfg.Binary, cfg.ApparmorProfile, parallelismSem)

View File

@ -93,7 +93,7 @@ func testParallelism(t *testing.T, sb integration.Sandbox) {
type parallelismSetterSingle struct{} type parallelismSetterSingle struct{}
func (*parallelismSetterSingle) UpdateConfigFile(in string) string { func (*parallelismSetterSingle) UpdateConfigFile(in string) string {
return in + "\n\nmax-parallelism = 1\n" return in + "\n\n[worker.oci]\n max-parallelism = 1\n\n[worker.containerd]\n max-parallelism = 1\n"
} }
var maxParallelismSingle integration.ConfigUpdater = &parallelismSetterSingle{} var maxParallelismSingle integration.ConfigUpdater = &parallelismSetterSingle{}