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

Allow changing existing jib images without the "package" maven goal having run #4272

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

Comments

@wleese
Copy link

wleese commented Jun 11, 2024

Environment:

  • Jib version: 3.4.3
  • Build tool: Maven 3.9.7
  • OS: Linux

Description of the issue:

While getting CDS to work with containerizingMode packaged & jib works, there's a task where I simply want to add a file to an existing Jib container.

When I simply run:

      ./mvnw -Drevision="${VERSION}" \
        -Djib.to.image="${DOCKER_IMAGE}:${VERSION}" \
        -Djib.from.image="${DOCKER_IMAGE}:${VERSION}" \
        -Djib.extraDirectories.paths=./cds_output \
        -Djib.container.jvmFlags=-XX:SharedArchiveFile=/application.jsa \ # <3>
        jib:build

I get the error:

Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.3:build (default-cli) on project cdstestng-app: Obtaining project build output files failed; make sure you have packaged your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean package jib:build"?):

This makes perfect sense in the traditional setup of building an application and then containerizing, but because I'm using Jib to perform 3 actions (build, run to generate the cds data, insert the cds data into previously built image), I run into having to have the build artifacts from the first action, despite there not being a strict need for these files (as far as I'm aware) because we already have access to the container image.

One can run into this issue when there's a CICD pipeline where these actions are split into jobs, each with their own clean environment. Because of this issue, I have to explicitly configure the pipeline to bring the artifacts from the build action (job) to the final action (job) just to get Jib to run.

Expected behavior:

It would be great for the CDS use case if Jib could modify an existing image, without an artificial (?) requirement on a previous maven phase having run.

@wleese wleese changed the title Enable Allow changing existing jib images without the "package" maven goal having run Jun 11, 2024
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