Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional jvmflag support #4270

Open
wleese opened this issue Jun 8, 2024 · 0 comments
Open

Add additional jvmflag support #4270

wleese opened this issue Jun 8, 2024 · 0 comments

Comments

@wleese
Copy link

wleese commented Jun 8, 2024

It would be good for Jib to provide a way to easily take an image previously created by Jib, and to 'append' to it in various ways.

That would benefit the CDS workflow of starting an application via a container, capturing some data and then putting it into a new image (optionally overwriting the old one) and adding some jvm flags.

Note that while there are sufficient workarounds at this point in time, I'm looking for improvements to Jib to make it more elegant.

I currently use the following workflow in a GitLab CICD pipeline to get CDS to work (this being what Spring Framework recommends: https://docs.spring.io/spring-framework/reference/integration/cds.html).

  1. In a job, build the Jib image with containerizingMode=packaged
  2. In the next job, run that image with -XX:ArchiveClassesAtExit=application.jsa -Dspring.context.exit=onRefresh
  3. In the final job, pick up that application.jsa file, add it to the existing image and change the entrypoint to include -XX:SharedArchiveFile=/application.jsa

It works quite well, except step 3.
Here I have to run the following

      mkdir cds_output; cp application.jsa cds_output/ 
      ./mvnw -Drevision="${VERSION}" \
        -Djib.to.image="${DOCKER_IMAGE}:${VERSION}" \
        -Djib.from.image="${DOCKER_IMAGE}:${VERSION}" \
        -Djib.containerizingMode=packaged \
        -Djib.extraDirectories.paths=./cds_output \
        -Djib.container.jvmFlags=-XX:SharedArchiveFile=/application.jsa \ 
        jib:build

Now the jvmFlags overwrites whatever the user has already set in their pom.xml.

It would be of great help if there was an option to append to the jvmFlags, so that both options in pom.xml and via the commandline could work together.

This issue is related to the CDS support request #2471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants