Skip to content

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

@wleese

Description

@wleese

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions