diff --git a/cli/compose/loader/full-example.yml b/cli/compose/loader/full-example.yml index 36ebf833e7..47d2059c61 100644 --- a/cli/compose/loader/full-example.yml +++ b/cli/compose/loader/full-example.yml @@ -1,6 +1,12 @@ version: "3.13" services: + bar: + image: busybox:latest + depends_on: + foo: + condition: service_started + required: true foo: build: diff --git a/cli/compose/loader/testdata/full-example.yaml.golden b/cli/compose/loader/testdata/full-example.yaml.golden index ec925790ad..700161ab60 100644 --- a/cli/compose/loader/testdata/full-example.yaml.golden +++ b/cli/compose/loader/testdata/full-example.yaml.golden @@ -1,5 +1,11 @@ version: "3.13" services: + bar: + image: busybox:latest + depends_on: + foo: + condition: service_started + required: true foo: build: context: ./dir diff --git a/cli/compose/schema/data/config_schema_v3.12.json b/cli/compose/schema/data/config_schema_v3.12.json index 2a548a3816..cc49b33fbe 100644 --- a/cli/compose/schema/data/config_schema_v3.12.json +++ b/cli/compose/schema/data/config_schema_v3.12.json @@ -133,7 +133,33 @@ }, "additionalProperties": false }, - "depends_on": {"$ref": "#/definitions/list_of_strings"}, + "depends_on": { + "oneOf": [ + {"$ref": "#/definitions/list_of_strings"}, + { + "type": "object", + "additionalProperties": false, + "patternProperties": { + "^[a-zA-Z0-9._-]+$": { + "type": "object", + "additionalProperties": false, + "properties": { + "restart": {"type": "boolean"}, + "required": { + "type": "boolean", + "default": true + }, + "condition": { + "type": "string", + "enum": ["service_started", "service_healthy", "service_completed_successfully"] + } + }, + "required": ["condition"] + } + } + } + ] + }, "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "dns": {"$ref": "#/definitions/string_or_list"}, "dns_search": {"$ref": "#/definitions/string_or_list"},