As rules_docker is no longer maintained and has some lingering multi-arch issues... we switched to the new rules_oci for image packaging and distribution. It seems that the default resolver doesn't like the new package format for image tarballs (via rule oci_tarball). We get the following error when trying to run rules_k8s targets:
2023/03/31 12:30:39 Unable to publish images: error reading image: unable to load layers from the given parts: unable to build a v1.Layer from the specified parts: unable to load the hashes for compressed layer at : unable to load layer digest from : open : no such file or directory
Here is an example of our bazel build file:
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
pkg_tar(
name = "tar",
deps = [":file"],
)
oci_tarball(
name = "image_tar",
image = ":image",
repotags = ["local:latest"],
)
oci_image(
name = "image",
architecture = select({
"@platforms//cpu:arm64": "arm64",
"@platforms//cpu:x86_64": "amd64",
}),
base = "@base",
os = "linux",
tars = [":tar"],
)
k8s_object(
name = "k8s",
cluster = "",
images = {
"local:latest": ":image_tar",
},
kind = "list",
template = ":manifests.json",
)
I am going to try and create a custom resolver to parse the new manifest.json created by rules_oci... but it would be nice if the default resolver supported these new rules.
Here is an example of a new manifest.json (which is part of the oci_tarball output):
[
{
"Config": "blobs/sha256/43439010ce4367cd30de9c43b64171665704c512f2c0e9d63d727233c0f3abd2",
"RepoTags": ["local:latest"],
"Layers": [
"blobs/sha256/895e193edb5191bf66fb5ccb29f5d3659e05eec5953255180cbdd66520e7c517.tar.gz",
"blobs/sha256/a3e3778621b5e58a0815912eed90e94465c777e2eddd608a5d7200734d003c0f.tar.gz",
"blobs/sha256/e7cf2c69b92718146707bbea7ebc3259f7611a82166022fd8e87ccc0734d8ea3.tar.gz",
"blobs/sha256/df40c119df08dddd7210dbf24a59d06a3c0a2b060cfd0425378d47d1e93b106d.tar.gz",
"blobs/sha256/3b29ea6a27afdac6d3e208f68782496bb55556f762154a72e1bc5537c33ccc2c.tar.gz",
"blobs/sha256/3997cd6195209aee35967340943da6183326767d9f62df155f3cfbd785b00d9f.tar.gz",
"blobs/sha256/7e759f975aace530060342a4cbc84811bdbf168cbb0457b7275c8a94ddd5514a.tar.gz",
"blobs/sha256/ff133072f235dc4955219ef185bc24e87b935c0e74160fa86645f5822981d9e8.tar.gz",
"blobs/sha256/f9a56094a361b8d24a46359c112f8436885e5665425766f62b6910386e17caf4.tar.gz",
"blobs/sha256/f188b9e6fee9485edc66809618f7cb82a56f4d283cb25f7f44d8dc2c4b46021a.tar.gz"
]
}
]
Links:
As rules_docker is no longer maintained and has some lingering multi-arch issues... we switched to the new
rules_ocifor image packaging and distribution. It seems that the default resolver doesn't like the new package format for image tarballs (via ruleoci_tarball). We get the following error when trying to run rules_k8s targets:Here is an example of our bazel build file:
I am going to try and create a custom resolver to parse the new
manifest.jsoncreated by rules_oci... but it would be nice if the default resolver supported these new rules.Here is an example of a new
manifest.json(which is part of the oci_tarball output):Links: