v2.0.0-rc0
github-actions
released this
27 Aug 04:54
·
15 commits
to main
since this release
Using bzlmod with Bazel 6 or later:
-
Add
common --enable_bzlmod
to.bazelrc
. -
Add to your
MODULE.bazel
file:
bazel_dep(name = "rules_oci", version = "2.0.0-rc0")
# For testing, we also recommend https://registry.bazel.build/modules/container_structure_test
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
# Declare external images you need to pull, for example:
oci.pull(
name = "distroless_base",
# 'latest' is not reproducible, but it's convenient.
# During the build we print a WARNING message that includes recommended 'digest' and 'platforms'
# values which you can use here in place of 'tag' to pin for reproducibility.
tag = "latest",
image = "gcr.io/distroless/base",
platforms = ["linux/amd64"],
)
# For each oci.pull call, repeat the "name" here to expose them as dependencies.
use_repo(oci, "distroless_base")
Using WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_oci",
sha256 = "79e7f80df2840d14d7bc79099b5ed4553398cce8cff1f0df97289a07f7fd213c",
strip_prefix = "rules_oci-2.0.0-rc0",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-rc0/rules_oci-v2.0.0-rc0.tar.gz",
)
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
rules_oci_dependencies()
load("@rules_oci//oci:repositories.bzl", "oci_register_toolchains")
oci_register_toolchains(name = "oci")
# You can pull your base images using oci_pull like this:
load("@rules_oci//oci:pull.bzl", "oci_pull")
oci_pull(
name = "distroless_base",
digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86",
image = "gcr.io/distroless/base",
platforms = [
"linux/amd64",
"linux/arm64",
],
)
What's Changed
- chore: remove deprecated config_path attribute by @thesayyn in #666
- Fix for gnu xargs and send --verbose to other commands by @vinnybod in #672
- fix: include examples by @thesayyn in #682
- chore(docs): mention rules_multirun by @alexeagle in #681
- refactor: mention url rewriter in oci_pull errors by @thesayyn in #675
New Contributors
BREAKING CHANGES
- Uncompressed archives in the tars attribute is no longer compressed when creating the image, this might make images bigger compared to 1.x. Use pkg_tar#extension or tar#compress attribute to compress the layers beforehand.
# For pkg_tar
pkg_tar(
extension = "tar.gz"
)
# For tar
tar(
compress = "gzip"
)
- Digests of images created 1.x rules_oci will not match 2.x rules_oci, as we are no longer using crane to create the images. However, images should stay the same semantically. You can use diffoci to make sure they are the same semantically!
- Default output of
oci_tarball
is no longer a tarball, use afilegroup
target to get the tarball. See #548 oci_tarball
is renamed tooci_load
to better reflect it's purpose.- Bazel 5 is no longer supported, and tested by the CI, we will not be accepting fixes for it.
SIGNIFICANT CHANGES
- OCIImage action no longer spins an ephemeral registry instance to mutate images locally, making it slightly faster.
- oci_image now supports
zstd
compression - Now oci_pull fetches blobs in parallel on
Bazel >= 7.1
API Removals
- oci_pull no longer has a
config_path
attribute, useconfig
attribute instead. It was deprecated in 1.x.
Full Changelog: v2.0.0-beta2...v2.0.0-rc0