gradle-docker-compose-plugin
gradle-docker-compose-plugin copied to clipboard
Add support for `docker compose`
Enable using dockerComposeV2.set(true)
Should fix https://github.com/avast/gradle-docker-compose-plugin/issues/322, but hasn't been thoroughly tested
@augi Have you given this some more thought?
Sorry, we had the discussion in #322
What should be done in order to finish this PR:
- Add the information about this to README.
- Add some kind of testing of this new feature. E.g. prepare also a new GitHub Action with ComposeV2 environment. But I guess this would be hard 😢
Sorry, we had the discussion in https://github.com/avast/gradle-docker-compose-plugin/issues/322
I know, but it kinda stopped there :D
I'll take a look at the readme
@augi I've added some info to the README. I don't know if more info is needed?
Thank you! 👍 Which platform do you use, please? I'm asking just because it would be nice to test this feature at least manually. I'm on Windows, so I could cover this.
I would test it manually in this way:
- Execute
publishLocal
to publish the plugin to local Maven (on your computer). - Try to use this version on a few real-world projects.
I'm on macOS. I'll check out publishLocal
:)
publishToMavenLocal
worked better. But somehow it still seems to use /usr/local/bin/docker-compose
even though I've set dockerComposeV2.set(true)
. Does it work for you? I'll investigate some more.
Obviously dockerComposeV2
will always be set to false
when we set the executable because of this line: https://github.com/henrik242/gradle-docker-compose-plugin/blob/36d4e2c47eac67b5fe6ca19950578fa9382a8654/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy#L127
So how do we get it to honor the configurated value?
Ah, got it, at least the testing makes sense 😄
We have to have a new getter for accessing executable
, and compute the value based on the current value (so not in constructor).
But we still have to provide the property to allow to set this value to a custom value. And we don't want to rename it now because it would break backward compatibility.
I'm now stuck on naming, I'm not sure how to name the new computed property 🤔
Btw. we already have something similar for the projectName
already: https://github.com/henrik242/gradle-docker-compose-plugin/blob/36d4e2c47eac67b5fe6ca19950578fa9382a8654/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy#L92
Btw. this PR is actually breaking the backward compatibility because the executable
property is transformed to a ListProperty
. This is also something we could try to avoid 🤔
I've pushed changes so that executable
doesn't break backward compatibility. I haven't looked into fixing dockerComposeV2
yet.
Thank you very much for your effort! 👍
I'm still not sure what is the best way how to introduce the V2 support 🤔 Actually, maybe it is so big change that we could break the backward compatibility (and release a new major version).
It would be great to get something like this merged in. I've tested out shimming docker-compose
to point to docker compose
(v2), and the plugin is able to handle the output (thanks to https://github.com/avast/gradle-docker-compose-plugin/pull/339, and a few other PRs).
I would also think it'd be great if support for the docker compose plugin could be merged. I could help with testing this on Linux. IMO, a dockerComposeV2
option sounds better than abandoning backwards compatibility and releasing a new major version (but I haven't looked at the code to see how hard it would be to keep backwards compatibility, so I don't know).
+1 for this.
We're getting the following when running:
$ ./gradlew composeUp
> Task :app:composeBuild
WARNING: Compose V1 is no longer supported and will be removed from Docker Desktop in an upcoming release. See https://docs.docker.com/go/compose-v1-eol/
WARNING: Compose V1 is no longer supported and will be removed from Docker Desktop in an upcoming release. See https://docs.docker.com/go/compose-v1-eol/
> Task :app:composeUp
WARNING: Compose V1 is no longer supported and will be removed from Docker Desktop in an upcoming release. See https://docs.docker.com/go/compose-v1-eol/
The sooner we can get this, the better 😁
Given that this PR is over a year old, I've opened a new PR to add this feature. The new PR attempts to address the comments mentioned in this PR as well, so hopefully we won't have to backtrack.
If anyone has time to do additional testing or to review, it would be much appreciated.
Addressed in #410