v1.3.0
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.3.0")
# 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 = "910926b6add3cf9dba74ccd52cc22791406aa00de751b1e552ee2b74967cde68",
strip_prefix = "rules_oci-1.3.0",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.3.0/rules_oci-v1.3.0.tar.gz",
)
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
rules_oci_dependencies()
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_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,
)
What's Changed
- Update release.yml by @alexeagle in #296
- fix: oci_tarball should support more than 2 repo_tags by @sfc-gh-ptabor in #300
- feat(windows): introduce batch wrapper by @alexeagle in #305
- fix(windows): account for \r\n line endings by @alexeagle in #304
- fix(windows): check in empty tar file rather than create dynamically by @alexeagle in #303
- fix(windows): use bazel-lib helper to read HOME env var by @alexeagle in #308
- fix(windows): prevent path transformation of arguments to crane mutate by @alexeagle in #306
- Ignore empty repo-tags in the file. Allow \n at the end of files. by @sfc-gh-ptabor in #312
- fix: restrict oci_image#tar attribute to .tar files by @alexeagle in #313
- fix: allow passwords that contain : by @tokongs in #314
- docs: improve bzlmod install instructions by @alexeagle in #316
New Contributors
Full Changelog: v1.2.0...v1.3.0