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.
Overview
As has been discussed in #322, #401, and this PR, Docker Compose V1 has reached its deprecation date and is no longer supported. While there are several workarounds (including one provided by Docker), these workarounds do not work for everyone and are not desirable in all cases. To this end, this PR adds the ability for
ComposeExecutor
to be configured to run usingdocker compose
instead ofdocker-compose
.Additionally, this PR had the following goals:
Usage
To use Compose V2, all the user needs to do is add the
useDockerComposeV2
property to thedockerCompose
section of theirbuild.gradle
file:Verification
In addition to the unit test added in this PR, the code changes proposed here have been tested and verified to work in a real-world project before the PR was submitted.
Test Procedure
The following are the steps I used to test these changes in a real-world project:
./gradlew clean composeUp
and./gradlew clean composeDown
Test Results
Running the test version of the plugin without the
useDockerComposeV2
property set resulted in the following console output. It can plainly be seen that the plugin is using Compose V1 to stand up the stack by the presence of theWARNING
lines.Running the test version of the plugin with
useDockerComposeV2 = false
resulted in the following console output. Once again, it's clear that the plugin is using Compose V1.Running the test version of the plugin with
useDockerComposeV2 = true
resulted in the following console output. In this case, it's clear the plugin was using Compose V2 because theWARNING
lines are no longer present.These tests were performed on a MacBook Pro M1 Max running OSX 13.4.1 (Ventura), using gradle 7.5.1 and Java 17 (Amazon Corretto 17.0.8).