v1.4.1
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 = "1.4.1")
# 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 = "ad4c9e8da16a92b680772973f77c5dc8d22db6887082dc0a6665277d0897e191",
strip_prefix = "rules_oci-1.4.1",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.4.1/rules_oci-v1.4.1.tar.gz",
)
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
rules_oci_dependencies()
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_toolchains")
oci_register_toolchains(
name = "oci",
crane_version = LATEST_CRANE_VERSION,
# Uncommenting the zot toolchain will cause it to be used instead of crane for some tasks.
# Note that it does not support docker-format images.
# zot_version = LATEST_ZOT_VERSION,
)
# 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(fmt): pre-commit[buildifier] by @tx-chen in #376
- feat: add custom no_match_error to oci_alias by @thesayyn in #364
- refactor: clean up variables and messages by @thesayyn in #362
- oci_tarball: set mtime to 2000-01-01 by @gergelyfabian in #380
- Revert "oci_tarball: set mtime to 2000-01-01" by @alexeagle in #383
- fix: prevent failure if no fixed_args provided by @thesayyn in #397
- chore: enable some CI on macos again by @alexeagle in #390
- chore: avoid generated deltas in code review by @alexeagle in #400
- chore: turn off more MacOS testing by @alexeagle in #399
- Update ci.yaml by @alexeagle in #398
- fix: forward well known attributes to macro expanded targets (#370) by @thesayyn in #392
- feat: add Snowflake's registries support for oci_pull by @sfc-gh-dszot in #379
- refactor: simplify repotags processing by @illicitonion in #401
- Support tar files for multi-arch images by @illicitonion in #325
- fix: fixed go and rust doc by @liningpan in #402
New Contributors
- @tx-chen made their first contribution in #376
- @gergelyfabian made their first contribution in #380
- @sfc-gh-dszot made their first contribution in #379
- @illicitonion made their first contribution in #401
- @liningpan made their first contribution in #402
Full Changelog: v1.4.0...v1.4.1