cli/compose: allow depends_on advanced syntax

While stack does not support "depends_on", and will produce an warning when
used, it's useful to allow it to _parse_ a compose-file that uses the
advanced syntax.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-01-08 13:32:53 +01:00
parent cfe18f5e03
commit 46be579991
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 39 additions and 1 deletions

View File

@ -1,6 +1,12 @@
version: "3.12"
services:
bar:
image: busybox:latest
depends_on:
foo:
condition: service_started
required: true
foo:
build:

View File

@ -1,5 +1,11 @@
version: "3.12"
services:
bar:
image: busybox:latest
depends_on:
foo:
condition: service_started
required: true
foo:
build:
context: ./dir

View File

@ -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"},