Skip to content

v2.0.0-alpha3

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Jun 20:54
· 50 commits to main since this release
3be6471

Using bzlmod with Bazel 6 or later:

  1. Add common --enable_bzlmod to .bazelrc.

  2. Add to your MODULE.bazel file:

bazel_dep(name = "rules_oci", version = "2.0.0-alpha3")
# 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 = "63eec71bfc258f6303709159e66a4cbec1fbdd9738a973ebac4813ab20de1561",
    strip_prefix = "rules_oci-2.0.0-alpha3",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-alpha3/rules_oci-v2.0.0-alpha3.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

  • fix: return correct extension metadata by @thesayyn in #611
  • chore: add --check_direct_dependencies to .bazelrc by @gregmagolan in #615
  • fix: make oci_tarball work with disjoint output root by @thesayyn in #614
  • Copy files using coreutils cp by @plobsing in #595
  • Fix jq: error (at <stdin>:16): Cannot use null (null) as object key error on empty line in labels file by @bozaro in #606
  • fix: env vars containing = by @thesayyn in #616

New Contributors

Full Changelog: v2.0.0-alpha2...v2.0.0-alpha3