Skip to content

Commit b1d616f

Browse files
Upgrade to bazel 7.2.1 (#60)
* Remove suggestion to use rules_oci as a library (we don't want to support that usage) * Define AnnotationArtifactDescription ourselves, as it's been removed from ocispec * Remove unused post_push_hooks * Migrate to bazel 7.2.1, updating dependencies too * bzl run //docs:update * Use bzlmod names instead of legacy workspace names * Update github.com/docker/docker to resolve CVE
1 parent 461b15b commit b1d616f

34 files changed

+2680
-2688
lines changed

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.4.0
1+
7.2.1

BUILD.bazel

+3-22
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
2-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
3-
load("//oci:toolchain.bzl", "oci_local_toolchain")
41
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
2+
load("@gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
3+
load("//oci:toolchain.bzl", "oci_local_toolchain")
54

65
# gazelle:prefix github.com/DataDog/rules_oci
76
# gazelle:go_naming_convention go_default_library
87
# gazelle:lang go
98

10-
bzl_library(
11-
name = "repositories",
12-
srcs = ["repositories.bzl"],
13-
visibility = ["//visibility:public"],
14-
deps = ["@bazel_gazelle//:deps"],
15-
)
16-
179
oci_local_toolchain(
1810
name = "oci_local_toolchain",
1911
)
@@ -30,20 +22,9 @@ gazelle_binary(
3022
],
3123
)
3224

33-
gazelle(
34-
name = "gazelle-update-repos",
35-
args = [
36-
"-from_file=go.work",
37-
"-to_macro=repositories.bzl%go_repositories",
38-
"-prune=true",
39-
"-build_file_proto_mode=disable",
40-
],
41-
command = "update-repos",
42-
)
43-
4425
alias(
4526
name = "go",
46-
actual = "@go_sdk//:bin/go",
27+
actual = "@rules_go//go",
4728
)
4829

4930
write_source_files(

MODULE.bazel

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module(
2+
name = "rules_oci",
3+
repo_name = "com_github_datadog_rules_oci",
4+
)
5+
6+
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3")
7+
bazel_dep(name = "bazel_skylib", version = "1.6.1")
8+
bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.6.1")
9+
bazel_dep(name = "gazelle", version = "0.36.0")
10+
bazel_dep(name = "rules_go", version = "0.47.1")
11+
bazel_dep(name = "rules_pkg", version = "0.10.1")
12+
bazel_dep(name = "stardoc", version = "0.6.2")
13+
14+
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
15+
16+
go_sdk.download(version = "1.22.5")
17+
18+
go_sdk.host()
19+
20+
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
21+
22+
go_deps.from_file(go_mod = "//:go.mod")
23+
24+
use_repo(
25+
go_deps,
26+
#"com_github_bazelbuild_bazel_gazelle",
27+
"com_github_blakesmith_ar",
28+
"com_github_containerd_containerd",
29+
"com_github_docker_docker_credential_helpers",
30+
"com_github_mitchellh_go_homedir",
31+
"com_github_opencontainers_go_digest",
32+
"com_github_opencontainers_image_spec",
33+
"com_github_sirupsen_logrus",
34+
"com_github_stretchr_testify",
35+
"com_github_urfave_cli_v2",
36+
"land_oras_oras_go",
37+
"org_golang_x_sync",
38+
)
39+
40+
oci_pull = use_repo_rule("//oci:defs.bzl", "oci_pull")
41+
42+
oci_pull(
43+
name = "ubuntu_focal",
44+
# Latest at "focal" tag
45+
digest = "sha256:9d6a8699fb5c9c39cf08a0871bd6219f0400981c570894cd8cbea30d3424a31f",
46+
registry = "ghcr.io",
47+
repository = "datadog/rules_oci/ubuntu",
48+
)
49+
50+
register_toolchains(
51+
"@com_github_datadog_rules_oci//:oci_local_toolchain",
52+
)

MODULE.bazel.lock

+2,160
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ manifests, image indexes (multi-arch images) and custom artifacts
1313

1414
In addition to Bazel rules, we offer many helpers for interacting with OCI
1515
artifacts under the `go/pkg` directory and a CLI tool for creating new OCI
16-
artifacts. You can add the Go library as a dependency by running `go get github.com/DataDog/rules_oci/go@latest`.
16+
artifacts.
1717

1818
`rules_oci` makes an effort to support Docker media types, but there is no
1919
guarantee of long-term support. Most CRI support the OCI types or there are
@@ -93,7 +93,7 @@ dependencies.
9393

9494
#### Updating dependencies
9595

96-
Run `bazel run :go -- get DEPENDENCY && bazel run :gazelle-update-repos`
96+
Run `bzl run //:go -- get DEPENDENCY`
9797

9898
#### Tests
9999

WORKSPACE

-150
This file was deleted.

bin/BUILD.bazel

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
load("//oci:toolchain.bzl", "create_compiled_oci_toolchains")
2-
load("@oci_push_hooks//:defs.bzl", "POST_PUSH_HOOKS")
32

43
exports_files(glob(["*"]))
54

@@ -12,7 +11,4 @@ filegroup(
1211
visibility = ["//visibility:public"],
1312
)
1413

15-
create_compiled_oci_toolchains(
16-
name = "oci_toolchain",
17-
post_push_hooks = POST_PUSH_HOOKS,
18-
)
14+
create_compiled_oci_toolchains(name = "oci_toolchain")

0 commit comments

Comments
 (0)