Use compose-go to load and parse compose file #5657
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.
- What I did
As we discussed with @glours in Slack, I took his branch, rebased it on the resent
main
branch, updated compose-go to the recent version and fixed all incompatibility issues.If this work gets some attention from maintainers, I'll call for testing in the related issue and in the Slack group to get volunteers to test these changes.
❗ everything you will read below is a verbatim copy of @glours PR's description since this PR is based on his work ❗
Use
compose-go
to parse, interpolate and merge Compose configurations.As this library, under active maintenance and development by the Compose team, is up to date with the recent evolutions of the Compose Specification it will remove the potential divergence between the 2 code base, make the maintenance and evolution easier for everyone.
As a side effect, it would remove the necessity of using the
version
attribute. It disturbs users, the official Docker message is: "You don't need the version attribute anymore in your Compose files" and the CLI continue to introduce new versions of compose v3 file format- How I did it
Import the
compose-go
library, removed the duplicated code for structs, keep only the specific checks done on forbidden, unsupported and deprecated properties on the parsing part.Remove the interpolation and merging functions and let
compose-go
doing the jobAdd the specific mapping for
x-cluster-spec
extension attribut to match theClusterVolumeSpec
structRemove all the duplicated tests already done on the
compose-go
side- How to verify it
Run tests
Use average Compose configurations and check we're still producing the same output than the current version
- Description for the changelog