-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Extract container image hash for use during later build steps #60
Comments
this can be done today using a tool like jq. oci_image rule outputs a directory that has an an example using a genrule and bazel-lib/jq
|
Thanks! Super helpful |
going to reopen. we should add an example for this |
Just wrote my own hacky version and then found this afterward. Would be great to have a good way to do this documented. genrule can't be used in a reusable .bzl right? rules_docker has a built-in '.digest' on |
@aran Could you show what you got? |
@farcop sure. (much credit to chatgpt... and I am not going to be using this)
|
@juanique points out that the digest we report here doesn't match what you get from |
Testing in this repo,
pushes to dockerhub, and their site confirms the digest matches: So, the digest for the However,
I can reproduce that it doesn't load something into the docker daemon that looks the same as if the image were pushed:
I think this is by design, in the sense that https://github.com/bazel-contrib/rules_oci/blob/main/oci/private/tarball.sh.tpl doesn't call crane so it doesn't guarantee to create the same image digest, but @thesayyn would know for sure. |
I believe this is different issue than docker tarballs not matching the hash in oci-layout. |
Coming back to this again, unfortunately the conversion from Similar feature request could be that I am going to file a separate issue for this for better tracking. |
I would like to be able to create container image locally and then use the container image hash during a later build step (to embed the container image hash in a binary).
Is this already supported or do you have a pointer to how I could contribute this functionality?
Kind regards
The text was updated successfully, but these errors were encountered: