gradle-docker-plugin icon indicating copy to clipboard operation
gradle-docker-plugin copied to clipboard

Fix Gradle 6.9.x support

Open Sineaggi opened this issue 2 years ago • 3 comments

Fixes a compatibility issue with Gradle 6.9.x

Without this builds fail with

> Task :dockerCreateDockerfile
FAILURE: Build failed with an exception.

* What went wrong:
Receiver class com.bmuschko.gradle.docker.tasks.image.Dockerfile$CopyFile does not define or inherit an implementation of the resolved method 'abstract java.lang.Object getProperty(java.lang.String)' of interface groovy.lang.GroovyObject.
2 actionable tasks: 2 executed

closes #1096

Sineaggi avatar Sep 13 '22 20:09 Sineaggi

I am not sure if that will actually fix the issue. It seems more of a Groovy-compatibility issue as described here. My guess is that it is a binary-compatibility issue. One more reason to turn the Groovy production source code to Java.

bmuschko avatar Sep 18 '22 23:09 bmuschko

@bmuschko Unfortunately I haven't seen any Gradle devs chime in wrt binary compatibility issues wrt groovy 2 and 3. Wish binary-compatibility would be something mentioned in their compatibility page. At present the existing docs are a little sparse on details.

FWIW I ran some of the existing functional tests against 6.9.2 via the method michel-kraemer talked about in https://github.com/bmuschko/gradle-docker-plugin/pull/1095 and found a few more places where this issue popped up. This fix is closer to whack-a-mole.

Sineaggi avatar Sep 19 '22 02:09 Sineaggi

They basically say this here:

Gradle plugins written in Groovy must use Groovy 3.x for compatibility with Gradle and Groovy DSL build scripts.

bmuschko avatar Sep 19 '22 20:09 bmuschko

Maybe it's better to migrate DockerExtension to Java as well, not only DockerRegistryCredentials? I can do this in my PR, as I'm already touching DockerExtension in it: https://github.com/bmuschko/gradle-docker-plugin/pull/1111

donbeave avatar Oct 31 '22 18:10 donbeave

We should move everything under src/main/groovy to Java at once. That's the primary reason I will likely not merge this PR here. It will solve the binary incompatibility issue once and for all. Granted, it's quite a bit of work. Let me know if someone is willing to tackle it. At this time, I don't necessarily have the capacity to do this work by myself.

bmuschko avatar Oct 31 '22 18:10 bmuschko

@bmuschko I can do it. Looks like not a lot of work for me. The question is how to do it without affecting other work, like this PR and all ongoing work on this issue: https://github.com/bmuschko/gradle-docker-plugin/issues/1102?

I think I can use this PR as a baseline. What do you think?

donbeave avatar Oct 31 '22 19:10 donbeave

@donbeave That'd be great. Let's finish the two outstanding PRs and then we can start the work on converting Groovy to Java. It'll be less of a hassle. I am planning to merge the two outstanding PR by EOW.

bmuschko avatar Nov 02 '22 02:11 bmuschko

Overall the PR looks good. A functional test is failing. Can you look into it? You may also want to merge master back into your branch. I fixed a couple of tests.

bmuschko avatar Jan 29 '23 20:01 bmuschko

@Sineaggi Is this still something you are planning to pursue? If you are not, let's close it.

bmuschko avatar Feb 21 '23 00:02 bmuschko

I am going to close this PR for now. I'd be more than happy to reopen if you want to pick this back up.

bmuschko avatar Mar 17 '23 20:03 bmuschko