GoogleContainerTools / jib

🏗 Build container images for your Java applications.
Apache License 2.0
13.58k stars 1.43k forks source link

It's likely that one of the dependencies that have the same name will not have their jar included in the image #4179

Open erdi opened 7 months ago

erdi commented 7 months ago

Environment:

Description of the issue:

It's likely that one of the dependencies that have the same name will not have their jar included in the image because the size of the jar is used as a file name differentiator for such dependencies.

Expected behavior:

It's extremely unlikely or even impossible for dependencies that have the same name to have their jar not included in the image.

Steps to reproduce:

  1. Use jib to build an image for a project that has two dependencies of the same name for which the size of their jar is also the same.
  2. Inspect the image and see that only one of the jars is included in the image.

Additional Information:

We have seen this happen in our project - we started getting ClassNotFoundExceptions inside of a container for a class that should be available and I tracked it down to two dependencies having the same name and same size of the jar file causing one of them to not be included in the image anymore.

I'm willing to provide a PR changing the file name differentiator to use a sequence number or hash of the file contents to resolve this issue. Please let me know if such PR would be considered before I put in the effort for it to be rejected straight away.

erdi commented 6 months ago

Would there be any interest in a PR as offered in the issue description, @alicejli?