Skip to content

Jib cannot load images created by bazel rules_oci 2.x #4382

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

Open
Sineaggi opened this issue Apr 11, 2025 · 0 comments
Open

Jib cannot load images created by bazel rules_oci 2.x #4382

Sineaggi opened this issue Apr 11, 2025 · 0 comments

Comments

@Sineaggi
Copy link
Contributor

Sineaggi commented Apr 11, 2025

Environment:

  • Jib Gradle plugin 3.4.5
  • Gradle 8.13
  • macos

Description of the issue:
Jib fails to load images produced with bazel's rules_oci 2.x

https://github.com/bazel-contrib/rules_oci/releases/tag/v2.0.0

This seems to be due to the following change

Uncompressed archives in the tars attribute is no longer compressed when creating the image, this might make images bigger compared to 1.x. Use pkg_tar#extension or tar#compress attribute to compress the layers beforehand.

When loading an image in from rules_oci, I see the exception

* What went wrong:
Execution failed for task ':app:jibBuildTar'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: org.apache.commons.compress.compressors.CompressorException: No Compressor found for the stream signature.

That tracks, as there is no longer any compression.

Expected behavior:

Build succeeds.

Steps to reproduce:

  1. start a local registry (docker run -d -p 5000:5000 --name registry registry)
  2. use bazel and rules_oci to produce a docker image (targeting a local registry, using rules_oci's oci_load)
  3. push to the local registry (docker push localhost:5000/distroless/java21:nonroot, required as jib can't load registry images)
  4. Try to build an image using that registry image (see gradle config below)

jib-gradle-plugin Configuration:

jib {
    from {
        setAllowInsecureRegistries(true)
        image = "localhost:5000/distroless/java21:nonroot"

Log output:

* What went wrong:
Execution failed for task ':app:jibBuildTar'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: org.apache.commons.compress.compressors.CompressorException: No Compressor found for the stream signature.

Additional Information:

Can be worked around by re-enabling compression as the rules_oci changelog points out.

    pkg_tar(
        name = "tar_java" + version + "_" + arch,
        extension = "tar.gz",
@Sineaggi Sineaggi changed the title Issue with loading images created by bazel rules_oci Jib cannot load images created by bazel rules_oci 2.x Apr 11, 2025
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