Plugin docker-remote-api is not compatible with Gradle 8.0
3ric-T opened this issue · 5 comments
Expected Behavior
As a user of docker-remote-api
plugin,
I want to have a plugin which runs with latest version 8.0 of gradle wrapper
So that I can build Docker images of my application
Current Behavior
Build fails with the following error:
Build file '/home/erict/workspaces_xxx/xxx/build.gradle.kts' line: 13
An exception occurred applying plugin request [id: 'com.bmuschko.docker-remote-api', version: '9.2.1']
> Failed to apply plugin 'com.bmuschko.docker-remote-api'.
> Using internal convention mapping with a Provider backed property.
Consult the upgrading guide for further information: https://docs.gradle.org/8.0/userguide/upgrading_version_7.html#convention_mapping
Full stacktrace is attached to the issue
With version 7.6 of Gradle, there is no issue. It seems to be related to the deprecation of some convetion mapping as stated in the error message.
Context
Simple declaration of the plugin, via version catalog file libs.versions.toml
:
[versions]
dockerRemoteApiPluginVersion = "9.2.1"
[libraries]
[bundles]
[plugins]
dockerRemoteApi = { id = "com.bmuschko.docker-remote-api", version.ref="dockerRemoteApiPluginVersion" }
Steps to Reproduce (for bugs)
Just declare the plugin as above in build file with Kotlin DSL. Any call to a Gradle task make it fail.
Your Environment
Gradle 8.0
Openjdk version "17.0.5"
I can't reproduce your issue with Gradle 8.0. I used the following build script:
plugins {
id 'com.bmuschko.docker-remote-api' version '9.2.1'
}
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
task createDockerfile(type: Dockerfile) {
from 'ubuntu:12.04'
label(['maintainer': 'Benjamin Muschko "benjamin.muschko@gmail.com"'])
}
task buildImage(type: DockerBuildImage) {
dependsOn createDockerfile
images.add('bmuschko/myimage:latest')
}
Please provide a project on GitHub that reproduces your issue.
Looking at the stack trace, it seems your issue seems to come from a different plugin:
com.netflix.gradle.plugins.docker.OsPackageDockerBasePlugin.createTasks(OsPackageDockerBasePlugin.groovy:41)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.netflix.gradle.plugins.docker.OsPackageDockerBasePlugin.this$dist$invoke$1(OsPackageDockerBasePlugin.groovy)
at com.netflix.gradle.plugins.docker.OsPackageDockerBasePlugin$2.methodMissing(OsPackageDockerBasePlugin.groovy)
Indeed, that's strange.
I didn't carefully look at the stacktrace, I'm sorry. I'll dig into this.
I created a project similar to yours, using version catalog file and Gradle 8.0, with only your plugin and it works perfectly.
Then it is related to another plugin which seems to pollute what I try to do. I close the ticket.
Sorry for the inconvenience, your plugin is really useful and saves us a lot of time creating Docker images for our products. Thanks for your work.
As you can see here, Nebula is using your plugin in its own gradle-ospackage-plugin
. But nowhere in the docs is referenced a task that builds Docker images. This plugin is designed to build RPM and DEB packages.
It seems that these pieces of code are abandonned, untouched since 4 years. I'll open a issue at Nebula's to see if they can do anything for that
Issue #421 opened
This plugin is designed to build RPM and DEB packages.
Yeah, that doesn't make sense. I am pretty sure https://github.com/nebula-plugins/gradle-ospackage-plugin/blob/main/src/main/groovy/com/netflix/gradle/plugins/docker/OsPackageDockerBasePlugin.groovy#L43 is the issue.