GoogleContainerTools / jib

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

jvmFlags.add throws UnsupportedOperationException in gradle jib plugin #4222

Open pavlovicaleksandar opened 6 months ago

pavlovicaleksandar commented 6 months ago

Hi awesome people who are working on this, this is not a blocker but something I thought would be nice for you to know 😄

Description of the issue: Bumping gradle jib plugin from version 4.3.1. to 4.4.1 was actually breaking change as it is not possible to add jvmFlags anymore after they have been initialized. We've find solution for it - we just create temporary list and assign flags at the end but still wanted to let you know about it. We use it in kotlin backend project.

Expected behavior: Bumping non-major version is not introducing breaking changes

Steps to reproduce:

  1. initialize jvmFlags with mutableList
  2. try to execute jvmFlags.add to add more flags and it will throw java.lang.UnsupportedOperationException (no error message) and report it on line you are trying to do jvmFlags.add

jib-gradle-plugin Configuration: I've pasted just small example what would break it

container {
      .
      .
      jvmFlags = mutableListOf("some flags")
      if (something) {
        jvmFlags.add("new flag")
      }
      .
      .
    }

Log output: java.lang.UnsupportedOperationException (no error message) at line where jvmFlags.add is called

diegomarquezp commented 3 months ago

@mpeddada1 @blakeli0 is this related to https://github.com/GoogleContainerTools/jib/pull/2975? If so, there may be a new way to specify the flags.

blakeli0 commented 3 weeks ago

Downgrading to P3 as there is already a workaround.