fix(parsing): support map form of depends_on with condition syntax#75
Open
24601 wants to merge 1 commit intoMcrich23:mainfrom
Open
fix(parsing): support map form of depends_on with condition syntax#7524601 wants to merge 1 commit intoMcrich23:mainfrom
24601 wants to merge 1 commit intoMcrich23:mainfrom
Conversation
Docker Compose allows depends_on to be expressed as either a list:
depends_on:
- db
or a map with condition metadata:
depends_on:
db:
condition: service_healthy
container-compose only handled the list (and single-string) forms,
throwing a typeMismatch error on the map form. This caused failures
on any real-world compose file that uses health-check gating.
Fix: after failing to decode as String or [String], attempt to decode
as [String: [String: String]] and extract the keys as the dependency
list. Conditions are silently dropped since Apple Container has no
equivalent concept at the orchestration layer.
Adds a parsing test covering the two-service map form with mixed
condition values (service_healthy, service_started).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
container-composethrows atypeMismatcherror on any compose file that uses the map form ofdepends_on:This is valid Docker Compose spec (v2+) and is common in real-world stacks (Windmill, Keycloak, Traefik setups, etc). Only the list form worked:
Fix
In
Service.swift, after failing to decode asStringor[String], attempt to decode as[String: [String: String]]and extract the map keys as the dependency list. Conditions are dropped since Apple Container has no equivalent orchestration-layer concept.Tests
Added
parseComposeWithDependenciesMapFormcovering:service_healthy,service_started)Both new and existing
depends_ontests pass.Verified against
Windmill CE
docker-compose.yml— previously failed at parse, now reaches image pull stage.