Skip to content

Commit 2c4ab0c

Browse files
committed
Distribute rules via http_archive
1 parent 8c5b324 commit 2c4ab0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2020
-350
lines changed

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
examples
12
node_modules

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ jobs:
1212
- uses: bazelbuild/setup-bazelisk@v1
1313
- run: bazel test --config=ci //...
1414
- run: bazel run //:gazelle -- -mode diff || exit 1
15+
- run: (cd examples && bazel build --config=ci //...)

BUILD.bazel

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
1+
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
22
load("@npm//:defs.bzl", "npm_link_all_packages")
33
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
44

@@ -20,6 +20,17 @@ gazelle(
2020
gazelle = ":gazelle-binary",
2121
)
2222

23+
gazelle(
24+
name = "gazelle-update-repos",
25+
args = [
26+
"-build_file_proto_mode=disable",
27+
"-from_file=go.mod",
28+
"-prune=true",
29+
"-to_macro=oci/private/repositories/go_repositories.bzl%go_repositories",
30+
],
31+
command = "update-repos",
32+
)
33+
2334
gazelle_binary(
2435
name = "gazelle-binary",
2536
languages = DEFAULT_LANGUAGES + [
@@ -38,6 +49,7 @@ pkg_tar(
3849
"//oci:files",
3950
"//oci/private:files",
4051
"//oci/private/repositories:files",
52+
"//oci/repositories:files",
4153
],
4254
empty_files = ["BUILD.bazel"],
4355
extension = "tar.gz",

MODULE.bazel

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ bazel_dep(name = "aspect_bazel_lib", version = "2.7.3")
77
bazel_dep(name = "aspect_rules_js", version = "2.1.2")
88
bazel_dep(name = "aspect_rules_lint", version = "1.0.8")
99
bazel_dep(name = "bazel_skylib", version = "1.6.1")
10-
bazel_dep(name = "gazelle", version = "0.38.0")
10+
bazel_dep(name = "gazelle", version = "0.38.0", repo_name = "bazel_gazelle")
1111
bazel_dep(name = "rules_go", version = "0.47.1", repo_name = "io_bazel_rules_go")
1212
bazel_dep(name = "rules_nodejs", version = "6.3.2")
1313
bazel_dep(name = "rules_pkg", version = "0.10.1")
@@ -16,14 +16,22 @@ bazel_dep(name = "stardoc", version = "0.6.2")
1616
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.6.1", dev_dependency = True)
1717
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)
1818

19+
single_version_override(
20+
module_name = "bazel_skylib_gazelle_plugin",
21+
patch_strip = 2,
22+
patches = [
23+
"//third_party/com_github_bazelbuild_bazel-skylib:01-pr-535-support-resolve.patch",
24+
],
25+
)
26+
1927
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
2028
go_sdk.download(
2129
name = "go_sdk",
2230
version = "1.22.5",
2331
)
2432
use_repo(go_sdk, "go_sdk")
2533

26-
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
34+
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
2735
go_deps.from_file(go_mod = "//:go.mod")
2836
use_repo(
2937
go_deps,
@@ -36,7 +44,6 @@ use_repo(
3644
"com_github_sirupsen_logrus",
3745
"com_github_stretchr_testify",
3846
"com_github_urfave_cli_v2",
39-
"land_oras_oras_go",
4047
)
4148
go_deps.module_override(
4249
patch_strip = 1,
@@ -46,7 +53,7 @@ go_deps.module_override(
4653
path = "github.com/containerd/containerd",
4754
)
4855

49-
oci_pull = use_repo_rule("//oci:repositories.bzl", "oci_pull")
56+
oci_pull = use_repo_rule("//oci:defs.bzl", "oci_pull")
5057

5158
oci_pull(
5259
name = "ubuntu_noble",

MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ rust_register_toolchains(
2929
load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
3030

3131
crates_repository(
32-
name = "crate_index",
32+
name = "com_github_datadog_rules_oci_crate_index",
3333
cargo_lockfile = "//:Cargo.lock",
3434
lockfile = "//:cargo-bazel-lock.json",
3535
manifests = [
@@ -39,6 +39,6 @@ crates_repository(
3939
rust_version = _RUSTC_VERSION,
4040
)
4141

42-
load("@crate_index//:defs.bzl", "crate_repositories")
42+
load("@com_github_datadog_rules_oci_crate_index//:defs.bzl", "crate_repositories")
4343

4444
crate_repositories()

cargo-bazel-lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "030e153464f00aa0a15a3162aa3e206b5e42faf52412bf783ec58f62406c22bc",
2+
"checksum": "bcebbb48f8aa8d2b6ef3a9c5b2cb5c8698f2f2eaa50fdd72a9e863b4b3314d6e",
33
"crates": {
44
"aho-corasick 1.1.3": {
55
"name": "aho-corasick",

docs/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ stardoc_with_diff_test(
1111
)
1212

1313
stardoc_with_diff_test(
14-
name = "repositories",
15-
bzl_library_target = "//oci:repositories",
14+
name = "pull",
15+
bzl_library_target = "//oci/repositories:pull",
1616
)
1717

1818
update_docs()

docs/defs.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -106,35 +106,3 @@ oci_image_layer
106106
| <a id="oci_image_layer-kwargs"></a>kwargs | Additional arguments to pass to the rule, e.g. `tags` or `visibility` | none |
107107

108108

109-
<a id="oci_pull"></a>
110-
111-
## oci_pull
112-
113-
<pre>
114-
oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-debug">debug</a>, <a href="#oci_pull-digest">digest</a>, <a href="#oci_pull-registry">registry</a>, <a href="#oci_pull-repo_mapping">repo_mapping</a>, <a href="#oci_pull-repository">repository</a>, <a href="#oci_pull-scheme">scheme</a>, <a href="#oci_pull-shallow">shallow</a>)
115-
</pre>
116-
117-
**ATTRIBUTES**
118-
119-
120-
| Name | Description | Type | Mandatory | Default |
121-
| :------------- | :------------- | :------------- | :------------- | :------------- |
122-
| <a id="oci_pull-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
123-
| <a id="oci_pull-debug"></a>debug | Deprecated. Does nothing | Boolean | optional | `False` |
124-
| <a id="oci_pull-digest"></a>digest | The digest or tag of the manifest file | String | required | |
125-
| <a id="oci_pull-registry"></a>registry | Remote registry host to pull from, e.g. `gcr.io` or `index.docker.io` | String | required | |
126-
| <a id="oci_pull-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | |
127-
| <a id="oci_pull-repository"></a>repository | Image path beneath the registry, e.g. `distroless/static` | String | required | |
128-
| <a id="oci_pull-scheme"></a>scheme | scheme portion of the URL for fetching from the registry | String | optional | `"https"` |
129-
| <a id="oci_pull-shallow"></a>shallow | Deprecated. Does nothing | Boolean | optional | `False` |
130-
131-
**ENVIRONMENT VARIABLES**
132-
133-
This repository rule depends on the following environment variables:
134-
* `DOCKER_CONFIG`
135-
* `REGISTRY_AUTH_FILE`
136-
* `XDG_RUNTIME_DIR`
137-
* `HOME`
138-
* `OCI_ENABLE_OAUTH2_SUPPORT`
139-
140-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
22

3-
public repository rules
3+
oci_pull
44

55
<a id="oci_pull"></a>
66

0 commit comments

Comments
 (0)