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

fix: Podman image inspect digest for local images #4298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mihalyr
Copy link

@mihalyr mihalyr commented Aug 22, 2024

When using docker:// prefix to use a base image from the local docker daemon, Jib expects the {{.Id}} field from the docker image inspect output to contain a valid image digest prefixed with sha256:. However, with Podman this is not the case and such builds fail with an "Invalid digest" exception, because Podman returns only the 64-char hash value in the {{.Id}} field without the sha256: prefix.

CliDockerClient already has the functionality to deal with the hashes without the sha256: prefix. A new method, fromDigestOrgHash has beend added to DescriptorDigest which first checks for the digest prefix and then checks for the hash. This allows full backwards compatibility and accepts the Podman version of the image Ids.

Fixes #4134 🛠️

Copy link

google-cla bot commented Aug 22, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

When using `docker://` prefix to use a base image from the local docker
daemon, Jib expects the `{{.Id}}` field from the `docker image inspect`
output to contain a valid image digest prefixed with `sha256:`. However,
with Podman this is not the case and such builds fail with an "Invalid
digest" exception, because Podman returns only the 64-char hash value in
the `{{.Id}}` field without the `sha256:` prefix.

`CliDockerClient` already has the functionality to deal with the hashes
without the `sha256:` prefix. A new method, `fromDigestOrgHash` has
beend added to `DescriptorDigest` which first checks for the digest
prefix and then checks for the hash. This allows full backwards
compatibility and accepts the Podman version of the image Ids.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant