avast / gradle-docker-compose-plugin

Simplifies usage of Docker Compose for integration testing in Gradle environment.
MIT License
413 stars 96 forks source link

Use gradle 8.2.1 + JDK 17, fix deprecation warning, fixes #409 #413

Closed tkrah closed 1 year ago

tkrah commented 1 year ago

That fixes the warning for me and I needed some more (small) changes to get it working at all with Gradle 8.2.1 API. Don't know for 100% if that is the way it should be done, but at least Spring did something similar here:

https://github.com/spring-projects/spring-boot/commit/0f52bbc5607ad91fcd3fa2791b2130c5c0d4ee96

L263+

My project still works with that modified PR - but take this PR with caution.

augi commented 1 year ago

Hi, thank you! And sorry - I've just updated the plugin to Gradle 7.x, so there is a conflict, and so your PR cannot be tested. Could you please resolve the conflict? Thanks!

tkrah commented 1 year ago

Tests are running with ./gradlew clean test and only that one is failing (at least here):

DockerExecutorTest > reads container logs

with:

java.lang.RuntimeException: Exit-code 1 when calling docker, stdout: 
    at com.avast.gradle.dockercompose.DockerExecutor.execute_closure1(DockerExecutor.groovy:37)
    at groovy.lang.Closure.call(Closure.java:412)
    at groovy.lang.Closure.call(Closure.java:428)
    at com.avast.gradle.dockercompose.DockerExecutor.execute(DockerExecutor.groovy:26)
    at com.avast.gradle.dockercompose.DockerExecutor.getInspections(DockerExecutor.groovy:64)
    at com.avast.gradle.dockercompose.tasks.ComposeUp.loadServicesInfo(ComposeUp.groovy:219)
    at com.avast.gradle.dockercompose.tasks.ComposeUp.up(ComposeUp.groovy:146)
    at com.avast.gradle.dockercompose.DockerExecutorTest.reads container logs(DockerExecutorTest.groovy:35)
 Container 386f498961b408d2785417143bc4d719_test_-hello-1  Creating
 Container 386f498961b408d2785417143bc4d719_test_-hello-1  Created
 Container 386f498961b408d2785417143bc4d719_test_-hello-1  Starting
 Container 386f498961b408d2785417143bc4d719_test_-hello-1  Started
"docker inspect" requires at least 1 argument.
See 'docker inspect --help'.

Usage:  docker inspect [OPTIONS] NAME|ID [NAME|ID...]

But it is failing without my change to the ComposeExtension too, so that seems not related, at least not to that special code change.

augi commented 1 year ago

I also encountered this failing test. The root cause was that the hello-world container executions is probably faster in Docker Compose V2, so the test doesn't see the running container (because it is already completed). I switched from hello-world Docker image to nginx. So please rebase on main again please (it also includes the change that V2 is default now).

tkrah commented 1 year ago

I also encountered this failing test. The root cause was that the hello-world container executions is probably faster in Docker Compose V2, so the test doesn't see the running container (because it is already completed). I switched from hello-world Docker image to nginx. So please rebase on main again please (it also includes the change that V2 is default now).

Looks good, clean test: BUILD SUCCESSFUL in 2m 59s

augi commented 1 year ago

Thank you very much for your effort. I´ve just done some cleaning and merged a code inspired by your code. The only main difference is that I´m cloning the closure before making any changes on it.

tkrah commented 1 year ago

@augi Did you see the latest fixes to fix those other convention deprecations?

tkrah commented 1 year ago

@augi added a question to your commit on: https://github.com/avast/gradle-docker-compose-plugin/commit/ea8f5e11333f441d247b076f19eaad04cb4cfd74#r124007319

augi commented 1 year ago

Sorry, I missed the latest changes. I will update the code.