From bf596e6a6f12563e7b9b30c7068d435498a4bd73 Mon Sep 17 00:00:00 2001 From: Sahin Yort Date: Thu, 16 Nov 2023 10:08:14 -0800 Subject: [PATCH] refactor: make crane write blobs to disk (#414) --- MODULE.bazel | 2 +- README.md | 3 +-- oci/private/registry/crane_launcher.sh.tpl | 2 +- oci/private/versions.bzl | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 160ff9cf..ceb333b2 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,7 +11,7 @@ bazel_dep(name = "bazel_skylib", version = "1.4.1") bazel_dep(name = "platforms", version = "0.0.5") oci = use_extension("//oci:extensions.bzl", "oci") -oci.toolchains(crane_version = "v0.14.0") +oci.toolchains(crane_version = "v0.16.1") use_repo(oci, "oci_auth_config", "oci_crane_registry_toolchains", "oci_crane_toolchains") register_toolchains("@oci_crane_toolchains//:all", "@oci_crane_registry_toolchains//:all") diff --git a/README.md b/README.md index 03821c80..4a438a8e 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,7 @@ Note that these examples rely on the setup code in the `/WORKSPACE` file in the rules_oci supports two different registry implementation for the temporary storage within actions spawned by bazel. 1. By default we recommend using `zot` as it stores blobs on disk, however it doesn't support `Docker`-format images. -2. `crane` is memory hungry as it stores blobs in memory, leading to high memory usage. - However it supports both `OCI` and `Docker` formats which is quite useful for using `Docker` images pulled from the registries such as DockerHub. +2. `crane` is a better alternative as it supports both `OCI` and `Docker` formats which is required to make images with `Docker` media types work. However, it might not support everything that zot does. ## Public API Docs diff --git a/oci/private/registry/crane_launcher.sh.tpl b/oci/private/registry/crane_launcher.sh.tpl index be812069..8d565237 100644 --- a/oci/private/registry/crane_launcher.sh.tpl +++ b/oci/private/registry/crane_launcher.sh.tpl @@ -6,7 +6,7 @@ function start_registry() { local output="$2" local deadline="${3:-5}" - "${CRANE_REGISTRY_BIN}" registry serve>> $output 2>&1 & + "${CRANE_REGISTRY_BIN}" registry serve --blobs-to-disk >> $output 2>&1 & local timeout=$((SECONDS+${deadline})) diff --git a/oci/private/versions.bzl b/oci/private/versions.bzl index 061f0f26..f9850249 100644 --- a/oci/private/versions.bzl +++ b/oci/private/versions.bzl @@ -2,6 +2,20 @@ # WARNING: only v0.12.0 and above is supported. CRANE_VERSIONS = { + "v0.16.1": { + "go-containerregistry-0": "sha256-KHa1NgQVE4cW1YN6aeHBFhgOSOz2KmP1MBw1HVoS+Zs=", + "darwin_arm64": "sha256-OgSfRI2SluHc01ZsWALiQbzU4Yc/mYoSKCRlXiDg10Q=", + "darwin_x86_64": "sha256-0AynKTFcu5FKFFQl2y49eoFsXB+DVFlxiBV64heyN34=", + "linux_arm64": "sha256-niJneTd6IHE/FqyU3sn2wX9piDTqQMM6bIb53ohFcis=", + "linux_armv6": "sha256-submkJ8j5DTlRA0E8om9KQ9+mMJBQotG0BAsYpn6NQ8=", + "linux_i386": "sha256-XXZ5/2Oz1poXNIbY9IOomRt2IDPAKN689md3nU5LqOU=", + "linux_ppc64le": "sha256-p7xthOifRHjqDB8owPkVlkAJJVUKYWeKQhIvtx9e/z8=", + "linux_s390x": "sha256-7yLdSqxExI4cSRIbQJaPfILy0Y+7Ze6fNmQpLb9abWk=", + "linux_x86_64": "sha256-EV3ITRTFrcicFuP6KX6U8GqexJK7Hccw2mJIULd8m+I=", + "windows_arm64": "sha256-H4CfiYT15fh9E9VRTeLYlv3/Ys+1Rnr2Gp1xAqFtpWE=", + "windows_armv6": "sha256-j6Oa4+kBYGOub0jlMSfUGNtpoCR0G/kACh4YB456PGE=", + "windows_x86_64": "sha256-iU9Nm6K8+07QE/f72n+WL3yS2+84/dFy1GdgdfTopRk=" + }, "v0.15.2": { "darwin_arm64": "sha256-XPquVFIWvxd6ZKhSo/HxI7lYBDjOYIoOnNy02uK6F0c=", "darwin_x86_64": "sha256-xzpmoZ4cwx0jKP07UvMZgZqb9sOKOA3/TfTeq6AsFHc=",