-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMODULE.bazel
91 lines (78 loc) · 2.53 KB
/
MODULE.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module(
name = "full_example",
version = "0.0.0",
)
bazel_dep(
name = "rules_gcs",
version = "0.0.0",
)
local_path_override(
module_name = "rules_gcs",
path = "../..",
)
bazel_dep(
name = "bazel_skylib",
version = "1.7.1",
)
bazel_dep(
name = "platforms",
version = "0.0.10",
)
# Fetching individual blobs works just like `http_file`
gcs_file = use_repo_rule("@rules_gcs//gcs:repo_rules.bzl", "gcs_file")
gcs_file(
name = "k8s_1_30_2_release_notes",
sha256 = "e879f76b7bac8effe4cc53bce034f258ce15b2825f3018c7078f25e832c3feb8",
url = "gs://kubernetes-release/release/v1.30.2/release-notes.json",
)
gcs_file(
name = "k8s_1_30_3_release_notes",
integrity = "sha256-kJtiyAtc4fUHXJyTAfeWc3J6d8RqUl8SxHUzcFNr/iw=",
url = "gs://kubernetes-release/release/v1.30.3/release-notes.json",
)
# Fetching an archive works just like `http_archive`
gcs_archive = use_repo_rule("@rules_gcs//gcs:repo_rules.bzl", "gcs_archive")
gcs_archive(
name = "kubernetes_1_30_3",
build_file_content = """exports_files(glob(["**"]))""",
integrity = "sha256-9x9WRt4Xw8n3IgE9T1PlChVoInD1YXrAYdQw6moWAM0=",
strip_prefix = "kubernetes",
url = "gs://kubernetes-release/release/v1.30.3/kubernetes.tar.gz",
)
# If you want to fetch a large number of objects from a bucket, you can use a JSON lockfile
gcs_bucket = use_extension("@rules_gcs//gcs:extensions.bzl", "gcs_bucket")
gcs_bucket.from_file(
name = "kubectl_binaries",
bucket = "kubernetes-release",
lockfile = "//:gcs_lock.json",
)
# If needed, you can specify how the data should be fetched:
# - symlink: lazy loading with a hub repo consisting of symlinks to blob repos
# - alias: lazy loading with a hub repo consisting of alias targets to the blob repos
# - copy: lazy loading with full file copies of blob contents
# - eager: all blobs are eagerly fetched into one repo
gcs_bucket.from_file(
name = "symlink_hub_repo",
bucket = "kubernetes-release",
lockfile = "//:gcs_lock.json",
method = "symlink",
)
gcs_bucket.from_file(
name = "alias_hub_repo",
bucket = "kubernetes-release",
lockfile = "//:gcs_lock.json",
method = "alias",
)
gcs_bucket.from_file(
name = "copy_hub_repo",
bucket = "kubernetes-release",
lockfile = "//:gcs_lock.json",
method = "copy",
)
gcs_bucket.from_file(
name = "eager_repo",
bucket = "kubernetes-release",
lockfile = "//:gcs_lock.json",
method = "eager",
)
use_repo(gcs_bucket, "alias_hub_repo", "copy_hub_repo", "eager_repo", "kubectl_binaries", "symlink_hub_repo")