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

FR: Ability to output oci_image as a .tar file #669

Closed
reddaly opened this issue Aug 6, 2024 · 8 comments
Closed

FR: Ability to output oci_image as a .tar file #669

reddaly opened this issue Aug 6, 2024 · 8 comments
Labels
can close? We'll close this issue if we don't get a new comment in 30 days.

Comments

@reddaly
Copy link

reddaly commented Aug 6, 2024

As part of migrating from rules_docker to rules_oci, I would like to list the contents of the file system of an image produced by oci_image. I'm not finding an easy way to do this.

I tried to use crane export to create a tarball from the image directory output by oci_image. However, Crane doesn't accept the image directory output by rules_oci as an argument to crane export (see google/go-containerregistry#1992).

@thesayyn
Copy link
Collaborator

thesayyn commented Aug 7, 2024

We have oci_load rule that you can use in combination with filegroup to get a .tar file. It's not likely that we are gonna make oci_image output a tar file as we learned that it is a recipe for disaster.

And as for filesystem inspection, you can use https://github.com/wagoodman/dive

Since, you can do this already today by creating a macro in your repo, there is nothing to fix here.

@thesayyn thesayyn added the can close? We'll close this issue if we don't get a new comment in 30 days. label Aug 7, 2024
@reddaly
Copy link
Author

reddaly commented Aug 7, 2024

What issues did you find with a .tar target?

@thesayyn
Copy link
Collaborator

thesayyn commented Aug 7, 2024

What issues did you find with a .tar target?

It is IO heavy, when there is multiple .tar targets building simultaneously, it creates huge IO load. Even in a single bit change in oci_image layers leads to recreation of the said tarball.

I have seen people;

  • Nuke the remote cache because they upgraded their base images
  • Have painfully slow CI, because a layer in the oci_image 5 level down has changed.

@hypdeb
Copy link

hypdeb commented Aug 25, 2024

I'm looking for a way of creating sysroots for a cc_toolchain and landed here. Would this feature allow me to use the filesystem of the image as said sysroot by extracting the .tar? Is this use-case already covered by another rule?

@thesayyn
Copy link
Collaborator

No, there is no rule in rules_oci that would allow you do flatten and extract layers from a base image.

@thesayyn
Copy link
Collaborator

I am going to close this issue as this is already supported by oci_load.

@andyliuliming
Copy link

andyliuliming commented Sep 10, 2024

looks like the file exported by the oci_load is in "docker" format instead of "oci"?
so the **.json.sha256 is different with the sha256 of the exported tar which may cause problem

@thesayyn
Copy link
Collaborator

so the **.json.sha256 is different with the sha256 of the exported tar which may cause problem

please see #617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can close? We'll close this issue if we don't get a new comment in 30 days.
Projects
None yet
Development

No branches or pull requests

4 participants