Skip to content

Releases: bazel-contrib/rules_oci

v2.0.1

13 Oct 18:53
859b8ff
Compare
Choose a tag to compare

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.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 = "acbf8f40e062f707f8754e914dcb0013803c6e5e3679d3e05b571a9f5c7e0b43",
    strip_prefix = "rules_oci-2.0.1",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.1/rules_oci-v2.0.1.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: declare and register regctl toolchains only for compatible platforms by @lbcjbb in #692
  • doc: mention containerd requirement by @thesayyn in #694
  • chore: bump to stardoc 0.6.2 by @gregmagolan in #719

Full Changelog: v2.0.0...v2.0.1

v2.0.0

05 Sep 22:03
c74c2d3
Compare
Choose a tag to compare

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 a filegroup target to get the tarball. See #548
  • oci_tarball is renamed to oci_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.
  • Delimiter for cmd and entrypoint changed from , to \n. See: #663

SIGNIFICANT CHANGES

  • OCIImage action no longer spins an ephemeral registry instance to mutate images locally, making it slightly faster. See design document
  • 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, use config attribute instead. It was deprecated in 1.x.

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")
# 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 = "d007e6c96eb62c88397b68f329e4ca56e0cfe31204a2c54b0cb17819f89f83c8",
    strip_prefix = "rules_oci-2.0.0",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0/rules_oci-v2.0.0.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

Read more

v2.0.0-rc0

27 Aug 04:54
9faf210
Compare
Choose a tag to compare

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-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

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 a filegroup target to get the tarball. See #548
  • oci_tarball is renamed to oci_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, use config attribute instead. It was deprecated in 1.x.

Full Changelog: v2.0.0-beta2...v2.0.0-rc0

v2.0.0-beta2

07 Aug 18:16
0be4040
Compare
Choose a tag to compare

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-beta2")
# 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 = "311e78803a4161688cc79679c0fb95c56445a893868320a3caf174ff6e2c383b",
    strip_prefix = "rules_oci-2.0.0-beta2",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-beta2/rules_oci-v2.0.0-beta2.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: support external oci_image targets by @thesayyn in #622
  • fix: reset cmd when entrypoint is set by @thesayyn in #656
  • fix: set created property for scratch base by @thesayyn in #655
  • Mention ociupdate in the README by @mark-thm in #660
  • fix: add history entries for tars attribute by @thesayyn in #654
  • fix typo in load.sh.tpl by @kopp in #657
  • test: add test for setting entrypoint to [] by @thesayyn in #662
  • fix: comma in entrypoint and cmd by @thesayyn in #663
  • fix: ensures confugure_buildx rule runs when bazel server restarts by @kvet in #670

New Contributors

Full Changelog: v2.0.0-beta1...v2.0.0-beta2

v1.8.0

12 Jul 16:53
c475294
Compare
Choose a tag to compare

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 = "1.8.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 = "46ce9edcff4d3d7b3a550774b82396c0fa619cc9ce9da00c1b09a08b45ea5a14",
    strip_prefix = "rules_oci-1.8.0",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.8.0/rules_oci-v1.8.0.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

New Contributors

Full Changelog: v1.7.6...v1.8.0

v2.0.0-beta1

03 Jul 17:27
4b843d6
Compare
Choose a tag to compare

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-beta1")
# 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 = "f70f07f9d0d6c275d7ec7d3c7f236d9b552ba3205e8f37df9c1125031cf967cc",
    strip_prefix = "rules_oci-2.0.0-beta1",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-beta1/rules_oci-v2.0.0-beta1.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",
    ],
)

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#compression or tar#compress attribute to compress the layers beforehand.
  • 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 a filegroup target to get the tarball. See #548
  • Bazel 5 is no longer supported.
  • oci_tarball is renamed to oci_load to better reflect it's purpose.

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

What's Changed

Full Changelog: v2.0.0-beta0...v2.0.0-beta1

v2.0.0-beta0

26 Jun 22:30
9a32fc2
Compare
Choose a tag to compare

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-beta0")
# 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 = "20024d18956c5b2feaf99701659e9711f3b97c468411a2e2d2e709dd24f31d90",
    strip_prefix = "rules_oci-2.0.0-beta0",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-beta0/rules_oci-v2.0.0-beta0.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",
    ],
)

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#compression or tar#compress attribute to compress the layers beforehand.
  • 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.
  • Default output of oci_tarball is no longer a tarball, use a filegroup target to get the tarball. See #548
  • Bazel 5 is no longer supported.
  • oci_tarball is renamed to oci_load to better reflect it's purpose.

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

What's Changed

  • feat: add support for settings volumes by @gzm0 in #632
  • refactor: rename oci_tarball to oci_load by @alexeagle in #636
  • fix: accumulate image manifests in oci_image_index by @seh in #633
  • tarball uses hermetic coreutils by @rickvanprim in #635

New Contributors

Full Changelog: v2.0.0-alpha5...v2.0.0-beta0

v2.0.0-alpha5

12 Jun 18:19
464858a
Compare
Choose a tag to compare
v2.0.0-alpha5 Pre-release
Pre-release

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-alpha5")
# 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 = "768cd23d5fea0235858eecfc8bfaae77a11fe9db9ebb1ac03d31c4b19eb9bc11",
    strip_prefix = "rules_oci-2.0.0-alpha5",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-alpha5/rules_oci-v2.0.0-alpha5.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

New Contributors

Full Changelog: v2.0.0-alpha4...v2.0.0-alpha5

v2.0.0-alpha4

10 Jun 20:59
09d5521
Compare
Choose a tag to compare
v2.0.0-alpha4 Pre-release
Pre-release

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-alpha4")
# 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 = "02df4efc5c7431904a927c1947fc7b6e2eda838b038b15bdf9a15918e7d6c04b",
    strip_prefix = "rules_oci-2.0.0-alpha4",
    url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-alpha4/rules_oci-v2.0.0-alpha4.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

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

v2.0.0-alpha3

07 Jun 20:54
3be6471
Compare
Choose a tag to compare
v2.0.0-alpha3 Pre-release
Pre-release

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