refactor: use docker compose api for parsing#465
Open
lucarin91 wants to merge 4 commits into
Open
Conversation
bec037f to
791320b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Docker Compose parsing in the orchestrator to rely on the official compose-go loader/types instead of manual YAML parsing and regex-based volume expansion, aiming to reduce duplicated parsing logic across the codebase.
Changes:
- Switch service extraction to
compose-go(loader.LoadWithContext) for reading service user/healthcheck metadata. - Switch volume provisioning to
compose-goparsing of bind mounts (and simplify call sites/tests accordingly). - Switch brick compose port extraction to
compose-goport types rather than string-splitting YAML.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/orchestrator/provision.go | Replaces manual compose parsing with compose-go for service metadata and volume provisioning. |
| internal/orchestrator/provision_test.go | Updates tests to call volume provisioning directly (no separate volume extraction step). |
| internal/orchestrator/bricksindex/bricks_index.go | Refactors port extraction from compose files to use compose-go loader/types. |
Comments suppressed due to low confidence (2)
internal/orchestrator/provision.go:554
- The comment above
provisionComposeVolumesstill claims volumes are "manually" parsed, but the implementation now uses compose-go. This is misleading documentation and also has a couple grammar issues ("ourself").
}
if e := writeOverrideCompose(); e != nil {
return e
}
internal/orchestrator/bricksindex/bricks_index.go:277
loader.LoadWithContextis called withoutFilename/WorkingDir. If brick compose files use relative paths or compose features that rely on the file location, port extraction can fail or behave inconsistently depending on the CLI working directory.
if err != nil {
return nil, err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Motivation
Remove manual Docker Compose parsing in multiple places
Change description
Additional Notes
Reviewer checklist
main.