Closed muhrifqii closed 5 months ago
The type of jib.container.format
is String
. Set either 'Docker'
or 'OCI'
. The BuildPlan is a separate concept, and the Jib plugin configuration is an abstraction on top of it.
https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#container-closure
Property | Type | Default | Description |
---|---|---|---|
format |
String |
Docker |
Use OCI to build an OCI container image. |
Environment: Jib version: 3.4.0 Build tool: Gradle 8.5 using kotlin script OS: MacOs Sonoma 4.2 / Ubuntu 22.04.3 IDE: IntelliJ IDEA 2023.3.2 (Ultimate Edition) Build #IU-233.13135.103, built on December 19, 2023
The type of
jib.container.format
isString
. Set either'Docker'
or'OCI'
. The BuildPlan is a separate concept, and the Jib plugin configuration is an abstraction on top of it.
I have the same experience as @muhrifqii. I'm also trying to do this in a gradle convention plugin.
Attempting to set it as a string will result in a type mismatch.
And if I try doing the same in a convention plugin then I get an unresolved reference for buildplan
.
Oddly enough, I don't run into the unresolved buildplan
package if setting the format in a regular build.gradle.kts
script (as opposed to a convention plugin). But then I'm only able to set the value directly using the enum of ImageFormat.Docker
(or OCI). Trying to set it as a String results in a type mismatch either way.
Perhaps odder yet is that I'm able to get Jib to work if I leave the format unset (default configuration which is ImageFormat.Docker
)
I wonder if it is just IntelliJ that incorrectly reports type mismatch inside the IDE. I would be surprised if running Gradle on the command-line actually fails.
In any case, you can try directly calling setFormat('Docker')
inside container
.
Closing this as it seems there is a viable workaround. Please reopen with more context if this is still an issue.
Environment:
Description of the issue: When we are using the convention to utilize the setting on each module, we cannot set
jib.container.format
because unresolved reference of com.google.cloud.tools.jib.api.buildplan, causingImageFormat.OCI
orImageFormat.Docker
cannot be customizedExpected behavior: can set the
jib.container.format
into enum values ofImageFormat.OCI
Steps to reproduce:
jib-gradle-plugin
Configuration:Log output: Cannot access class 'com.google.cloud.tools.jib.api.buildplan.ImageFormat'. Check your module classpath for missing or conflicting dependencies
Additional Information: