-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Determine the compose version via a CLI call and not the docker API. #1021
Determine the compose version via a CLI call and not the docker API. #1021
Conversation
7d075d1
to
c8bcafa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Can you please add a changelog fragment? Thanks. (I think this is more like a feature than a bugfix though. The module was never supposed to work with Podman, so it's not a bug that it didn't work with it.)
Regarding the implementation: I think it would be a lot cleaner if you could move the code into multiple methods. One method get_docker_compose_version()
(or similar) that calls docker compose version --formta json
and returns the version as a string, or None
if it cannot detemrine the version; and another method get_compose_plugin_version()
(or similar) that contains the current code (and returns the version as a string, or fails). And maybe a third method which calls the other two and always returns the version as a string.
c8bcafa
to
3186143
Compare
Sure thing, I wanted to know whether it passes CI first :) Added it as minor_change.
Done I think, let's see what CI says, locally it did work, but my test env is "limited" to a single python and docker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I've just have suggestion for the changelog fragment. This is about all docker_compose_v2* modules, not just docker_compose_v2 itself.
changelogs/fragments/1021-docker_compose_v2-version-detection.yml
Outdated
Show resolved
Hide resolved
3186143
to
6a4cc18
Compare
Co-authored-by: Felix Fontein <[email protected]>
@apollo13 thanks for your contribution! |
Thank you for the quick turnaround and support (as always ;)) |
SUMMARY
Call the CLI to determine the compose version before talking to the API.
Refs #891
ISSUE TYPE
COMPONENT NAME
docker_compose_v2