Skip to content

Support service extends in Compose files - #163

Open
GtechGovind wants to merge 1 commit into
Mcrich23:mainfrom
GtechGovind:fix/compose-extends-7
Open

GtechGovind wants to merge 1 commit into
Mcrich23:mainfrom
GtechGovind:fix/compose-extends-7

Conversation

@GtechGovind

Copy link
Copy Markdown

I added service inheritance resolution before typed Compose decoding, so a service can inherit its image or build configuration from a service in the same file or another Compose file.

The resolver follows chained references, detects missing files or services and circular references, and applies field-specific merge behavior for environment values, ports, commands, volumes, and env files. Paths inherited from an external file remain anchored to that file. Only referenced service configuration is inherited; unrelated external services and resources are not imported.

I added static regression tests for the reported inherited-image failure, same-file and external references, shorthand and chained inheritance, merge precedence, external paths, YAML anchors, missing references, and cycles.

Validation:

  • swift test --filter ComposeExtendsTests: 11 passed
  • swift test --filter Container_Compose_StaticTests: 260 passed
  • swift build --build-tests: passed
  • make build: passed

The dynamic container tests were not run; this change is covered by the static parsing suite.

Addresses #7.

@GtechGovind
GtechGovind marked this pull request as ready for review October 2, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant