From 271b9667eea268c4f9247071c8cc45343a8b09b5 Mon Sep 17 00:00:00 2001 From: Laura Brehm Date: Tue, 18 Apr 2023 14:51:49 +0100 Subject: [PATCH] Swarm: allow additional properties in `build` Since Swarm does not use the `build` section, there's no reason to validate properties here. This makes it so we don't have to keep updating the schema in the CLI to support properties added in the Compose Spec for build, and does not imply any new feature support since Swarm does not consider this section. Signed-off-by: Laura Brehm --- cli/compose/loader/loader_test.go | 13 ++++++++++++- cli/compose/schema/data/config_schema_v3.11.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index 1acd16bc2e..0be15d2fa4 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -179,7 +179,7 @@ func strPtr(val string) *string { } var sampleConfig = types.Config{ - Version: "3.10", + Version: "3.11", Services: []types.ServiceConfig{ { Name: "foo", @@ -488,6 +488,17 @@ services: assert.Check(t, is.ErrorContains(err, "services.foo.image must be a string")) } +func TestIgnoreBuildProperties(t *testing.T) { + _, err := loadYAML(` +services: + foo: + image: busybox + build: + unsupported_prop: foo +`) + assert.NilError(t, err) +} + func TestLoadWithEnvironment(t *testing.T) { config, err := loadYAMLWithEnv(` version: "3" diff --git a/cli/compose/schema/data/config_schema_v3.11.json b/cli/compose/schema/data/config_schema_v3.11.json index 3607514ee7..fb2c9fd84b 100644 --- a/cli/compose/schema/data/config_schema_v3.11.json +++ b/cli/compose/schema/data/config_schema_v3.11.json @@ -91,7 +91,7 @@ "shm_size": {"type": ["integer", "string"]}, "extra_hosts": {"$ref": "#/definitions/list_or_dict"} }, - "additionalProperties": false + "additionalProperties": true } ] },