Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions modules/rules_distroless/0.6.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
"Bazel dependencies"

module(
name = "rules_distroless",
compatibility_level = 1,
version = "0.6.1",
)

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_features", version = "1.20.0")
bazel_dep(name = "bazel_lib", version = "3.0.0-rc.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_java", version = "8.8.0")
bazel_dep(name = "rules_shell", version = "0.4.1")
bazel_dep(name = "gawk", version = "5.3.2.bcr.3")
bazel_dep(name = "tar.bzl", version = "0.6.0")
bazel_dep(name = "yq.bzl", version = "0.3.1")

yq_toolchains = use_extension("@yq.bzl//yq:extensions.bzl", "yq")
use_repo(yq_toolchains, "yq_darwin_amd64")
use_repo(yq_toolchains, "yq_darwin_arm64")
use_repo(yq_toolchains, "yq_linux_amd64")
use_repo(yq_toolchains, "yq_linux_arm64")
use_repo(yq_toolchains, "yq_linux_ppc64le")
use_repo(yq_toolchains, "yq_linux_s390x")
use_repo(yq_toolchains, "yq_windows_amd64")

bazel_lib_toolchains = use_extension("@bazel_lib//lib:extensions.bzl", "toolchains")
use_repo(bazel_lib_toolchains, "zstd_toolchains")

tar_toolchains = use_extension("@tar.bzl//tar:extensions.bzl", "toolchains")
use_repo(tar_toolchains, "bsd_tar_toolchains")

# Dev dependencies
bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.0.1", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.0.0", dev_dependency = True)
bazel_dep(name = "container_structure_test", version = "1.21.1", dev_dependency = True)
bazel_dep(name = "jq.bzl", version = "0.4.0", dev_dependency = True)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "example-bullseye-ca-certificates",
build_file_content = 'exports_files(["data.tar.xz", "control.tar.xz"])',
sha256 = "b2d488ad4d8d8adb3ba319fc9cb2cf9909fc42cb82ad239a26c570a2e749c389",
urls = ["https://snapshot.debian.org/archive/debian/20231106T210201Z/pool/main/c/ca-certificates/ca-certificates_20210119_all.deb"],
)

http_archive(
name = "example-bullseye-libc-bin",
build_file_content = 'exports_files(["data.tar.xz"])',
sha256 = "8b048ab5c7e9f5b7444655541230e689631fd9855c384e8c4a802586d9bbc65a",
urls = ["https://snapshot.debian.org/archive/debian-security/20231106T230332Z/pool/updates/main/g/glibc/libc-bin_2.31-13+deb11u7_amd64.deb"],
)

http_archive(
name = "example-bookworm-libc-bin",
build_file_content = 'exports_files(["data.tar.xz"])',
sha256 = "38c44247c5b3e864d6db2877edd9c9a0555fc4e23ae271b73d7f527802616df5",
urls = ["https://snapshot.debian.org/archive/debian-security/20231106T230332Z/pool/updates/main/g/glibc/libc-bin_2.36-9+deb12u3_armhf.deb"],
)
Comment on lines +42 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The http_archive repositories defined here are for examples, but they are not declared as development dependencies. This means that any downstream project that depends on rules_distroless will unconditionally download these .deb files and create these external repositories (example-bullseye-ca-certificates, example-bullseye-libc-bin, example-bookworm-libc-bin), even if they are not used. This adds unnecessary download overhead and pollutes the user's external repository space.

These repository definitions should only be evaluated when rules_distroless is the main module being built (i.e., for development and testing). To fix this, these http_archive calls should be moved into a module extension that is loaded with dev_dependency = True.


apt = use_extension(
"@rules_distroless//apt:extensions.bzl",
"apt",
dev_dependency = True,
)
apt.install(
name = "bullseye",
lock = "//examples/debian_snapshot:bullseye.lock.json",
manifest = "//examples/debian_snapshot:bullseye.yaml",
)
apt.install(
name = "bullseye_nolock",
manifest = "//examples/debian_snapshot:bullseye.yaml",
nolock = True,
)
apt.install(
name = "noble",
lock = "//examples/ubuntu_snapshot:noble.lock.json",
manifest = "//examples/ubuntu_snapshot:noble.yaml",
)
apt.install(
name = "resolution_test",
manifest = "apt/tests/resolution/security.yaml",
nolock = True,
)
apt.install(
name = "resolution_test_empty_lock",
lock = "//apt/tests/resolution:empty.lock.json",
manifest = "apt/tests/resolution/security.yaml",
)
apt.install(
name = "arch_all_test",
manifest = "apt/tests/resolution/arch_all.yaml",
nolock = True,
)
apt.install(
name = "unique_dependencies",
manifest = "//apt/tests/resolution:dependencies.yaml",
nolock = True,
)
apt.install(
name = "clang",
manifest = "apt/tests/resolution/clang.yaml",
nolock = True,
)
use_repo(apt, "arch_all_test", "arch_all_test_resolve", "bullseye", "bullseye_nolock", "clang", "noble", "resolution_test", "resolution_test_empty_lock_resolve", "resolution_test_resolve", "unique_dependencies_resolve")
17 changes: 17 additions & 0 deletions modules/rules_distroless/0.6.1/attestations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"mediaType": "application/vnd.build.bazel.registry.attestation+json;version=1.0.0",
"attestations": {
"source.json": {
"url": "https://github.com/bazel-contrib/rules_distroless/releases/download/v0.6.1/source.json.intoto.jsonl",
"integrity": "sha256-JotpRbKM8ENC/8D3cXPw+EB/IftQwnR/tJpM0IJNAfA="
},
"MODULE.bazel": {
"url": "https://github.com/bazel-contrib/rules_distroless/releases/download/v0.6.1/MODULE.bazel.intoto.jsonl",
"integrity": "sha256-Eux0DKch4oLkuCZKFF+DLZt8PVR+mmN2Hgplh/1/fpE="
},
"rules_distroless-v0.6.1.tar.gz": {
"url": "https://github.com/bazel-contrib/rules_distroless/releases/download/v0.6.1/rules_distroless-v0.6.1.tar.gz.intoto.jsonl",
"integrity": "sha256-kSmMFEQUHOI29RPrvG9doaZJGteYg0yoKFuLzlb/3nI="
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
===================================================================
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -2,8 +2,9 @@

module(
name = "rules_distroless",
compatibility_level = 1,
+ version = "0.6.1",
)

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_features", version = "1.20.0")
12 changes: 12 additions & 0 deletions modules/rules_distroless/0.6.1/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bcr_test_module:
module_path: "e2e/smoke"
matrix:
platform: ["debian10", "macos", "ubuntu2004"]
bazel: [7.x, 8.x]
tasks:
run_tests:
name: "Run test module"
bazel: ${{ bazel }}
platform: ${{ platform }}
test_targets:
- "//..."
10 changes: 10 additions & 0 deletions modules/rules_distroless/0.6.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"integrity": "sha256-lZ6hZtUWGDQpK9ekPu/QOFV4tpq4VkHLoOJ5r6dH+TM=",
"strip_prefix": "rules_distroless-0.6.1",
"docs_url": "https://github.com/bazel-contrib/rules_distroless/releases/download/v0.6.1/rules_distroless-v0.6.1.docs.tar.gz",
"url": "https://github.com/bazel-contrib/rules_distroless/releases/download/v0.6.1/rules_distroless-v0.6.1.tar.gz",
"patches": {
"module_dot_bazel_version.patch": "sha256-2t8FL947yXGa5vTTYltp/0cPdsHSQgm9Jgm44+lzGjU="
},
"patch_strip": 1
}
3 changes: 2 additions & 1 deletion modules/rules_distroless/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"0.4.1",
"0.4.2",
"0.5.1",
"0.5.3"
"0.5.3",
"0.6.1"
],
"yanked_versions": {}
}
Loading