Skip to content

Commit 16837a5

Browse files
authoredMar 31, 2024··
Migrate bb-autoscaler to bzlmod (#4)
1 parent df1ebf1 commit 16837a5

File tree

26 files changed

+13110
-2215
lines changed

26 files changed

+13110
-2215
lines changed
 

‎.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.4.0
1+
7.1.1

‎.github/workflows/master.yaml

+30-26
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
"name": "Installing Bazel",
1212
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
1313
},
14+
{
15+
"name": "Bazel mod tidy",
16+
"run": "bazel mod tidy"
17+
},
1418
{
1519
"name": "Gazelle",
16-
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
20+
"run": "rm $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
1721
},
1822
{
1923
"name": "Buildifier",
20-
"run": "sed '/^$/d' go_dependencies.bzl > go_dependencies.bzl.new && mv go_dependencies.bzl.new go_dependencies.bzl && bazel run @com_github_bazelbuild_buildtools//:buildifier"
24+
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
2125
},
2226
{
2327
"name": "Gofmt",
@@ -49,11 +53,11 @@
4953
},
5054
{
5155
"name": "linux_amd64: build and test",
52-
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
56+
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
5357
},
5458
{
5559
"name": "linux_amd64: copy bb_asg_lifecycle_hook",
56-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
60+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
5761
},
5862
{
5963
"name": "linux_amd64: upload bb_asg_lifecycle_hook",
@@ -65,7 +69,7 @@
6569
},
6670
{
6771
"name": "linux_amd64: copy bb_autoscaler",
68-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
72+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
6973
},
7074
{
7175
"name": "linux_amd64: upload bb_autoscaler",
@@ -77,11 +81,11 @@
7781
},
7882
{
7983
"name": "linux_386: build and test",
80-
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
84+
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
8185
},
8286
{
8387
"name": "linux_386: copy bb_asg_lifecycle_hook",
84-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
88+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_386 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
8589
},
8690
{
8791
"name": "linux_386: upload bb_asg_lifecycle_hook",
@@ -93,7 +97,7 @@
9397
},
9498
{
9599
"name": "linux_386: copy bb_autoscaler",
96-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
100+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_386 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
97101
},
98102
{
99103
"name": "linux_386: upload bb_autoscaler",
@@ -105,11 +109,11 @@
105109
},
106110
{
107111
"name": "linux_arm: build and test",
108-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
112+
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
109113
},
110114
{
111115
"name": "linux_arm: copy bb_asg_lifecycle_hook",
112-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
116+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
113117
},
114118
{
115119
"name": "linux_arm: upload bb_asg_lifecycle_hook",
@@ -121,7 +125,7 @@
121125
},
122126
{
123127
"name": "linux_arm: copy bb_autoscaler",
124-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
128+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
125129
},
126130
{
127131
"name": "linux_arm: upload bb_autoscaler",
@@ -133,11 +137,11 @@
133137
},
134138
{
135139
"name": "linux_arm64: build and test",
136-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
140+
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
137141
},
138142
{
139143
"name": "linux_arm64: copy bb_asg_lifecycle_hook",
140-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
144+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
141145
},
142146
{
143147
"name": "linux_arm64: upload bb_asg_lifecycle_hook",
@@ -149,7 +153,7 @@
149153
},
150154
{
151155
"name": "linux_arm64: copy bb_autoscaler",
152-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
156+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
153157
},
154158
{
155159
"name": "linux_arm64: upload bb_autoscaler",
@@ -161,11 +165,11 @@
161165
},
162166
{
163167
"name": "darwin_amd64: build and test",
164-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
168+
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
165169
},
166170
{
167171
"name": "darwin_amd64: copy bb_asg_lifecycle_hook",
168-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
172+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
169173
},
170174
{
171175
"name": "darwin_amd64: upload bb_asg_lifecycle_hook",
@@ -177,7 +181,7 @@
177181
},
178182
{
179183
"name": "darwin_amd64: copy bb_autoscaler",
180-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
184+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
181185
},
182186
{
183187
"name": "darwin_amd64: upload bb_autoscaler",
@@ -189,11 +193,11 @@
189193
},
190194
{
191195
"name": "darwin_arm64: build and test",
192-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
196+
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
193197
},
194198
{
195199
"name": "darwin_arm64: copy bb_asg_lifecycle_hook",
196-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
200+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_arm64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
197201
},
198202
{
199203
"name": "darwin_arm64: upload bb_asg_lifecycle_hook",
@@ -205,7 +209,7 @@
205209
},
206210
{
207211
"name": "darwin_arm64: copy bb_autoscaler",
208-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
212+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
209213
},
210214
{
211215
"name": "darwin_arm64: upload bb_autoscaler",
@@ -217,11 +221,11 @@
217221
},
218222
{
219223
"name": "freebsd_amd64: build and test",
220-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
224+
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
221225
},
222226
{
223227
"name": "freebsd_amd64: copy bb_asg_lifecycle_hook",
224-
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
228+
"run": "rm -f bb_asg_lifecycle_hook && bazel run --run_under cp --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook"
225229
},
226230
{
227231
"name": "freebsd_amd64: upload bb_asg_lifecycle_hook",
@@ -233,7 +237,7 @@
233237
},
234238
{
235239
"name": "freebsd_amd64: copy bb_autoscaler",
236-
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
240+
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
237241
},
238242
{
239243
"name": "freebsd_amd64: upload bb_autoscaler",
@@ -245,11 +249,11 @@
245249
},
246250
{
247251
"name": "windows_amd64: build and test",
248-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //..."
252+
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
249253
},
250254
{
251255
"name": "windows_amd64: copy bb_asg_lifecycle_hook",
252-
"run": "rm -f bb_asg_lifecycle_hook.exe && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook.exe"
256+
"run": "rm -f bb_asg_lifecycle_hook.exe && bazel run --run_under cp --platforms=@rules_go//go/toolchain:windows_amd64 //cmd/bb_asg_lifecycle_hook $(pwd)/bb_asg_lifecycle_hook.exe"
253257
},
254258
{
255259
"name": "windows_amd64: upload bb_asg_lifecycle_hook",
@@ -261,7 +265,7 @@
261265
},
262266
{
263267
"name": "windows_amd64: copy bb_autoscaler",
264-
"run": "rm -f bb_autoscaler.exe && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler.exe"
268+
"run": "rm -f bb_autoscaler.exe && bazel run --run_under cp --platforms=@rules_go//go/toolchain:windows_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler.exe"
265269
},
266270
{
267271
"name": "windows_amd64: upload bb_autoscaler",

‎.github/workflows/pull-requests.yaml

+14-10
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
"name": "Installing Bazel",
1212
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
1313
},
14+
{
15+
"name": "Bazel mod tidy",
16+
"run": "bazel mod tidy"
17+
},
1418
{
1519
"name": "Gazelle",
16-
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
20+
"run": "rm $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
1721
},
1822
{
1923
"name": "Buildifier",
20-
"run": "sed '/^$/d' go_dependencies.bzl > go_dependencies.bzl.new && mv go_dependencies.bzl.new go_dependencies.bzl && bazel run @com_github_bazelbuild_buildtools//:buildifier"
24+
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
2125
},
2226
{
2327
"name": "Gofmt",
@@ -49,35 +53,35 @@
4953
},
5054
{
5155
"name": "linux_amd64: build and test",
52-
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
56+
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
5357
},
5458
{
5559
"name": "linux_386: build and test",
56-
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
60+
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
5761
},
5862
{
5963
"name": "linux_arm: build and test",
60-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
64+
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
6165
},
6266
{
6367
"name": "linux_arm64: build and test",
64-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
68+
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
6569
},
6670
{
6771
"name": "darwin_amd64: build and test",
68-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
72+
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
6973
},
7074
{
7175
"name": "darwin_arm64: build and test",
72-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
76+
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
7377
},
7478
{
7579
"name": "freebsd_amd64: build and test",
76-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
80+
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
7781
},
7882
{
7983
"name": "windows_amd64: build and test",
80-
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //..."
84+
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
8185
}
8286
]
8387
}

‎BUILD.bazel

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
load("@bazel_gazelle//:def.bzl", "gazelle")
1+
load("@gazelle//:def.bzl", "gazelle")
22

3+
# gazelle:go_naming_convention_external import
34
# gazelle:prefix github.com/buildbarn/bb-autoscaler
45
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
56
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:execution
6-
# gazelle:resolve proto pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws:aws_proto
77
# gazelle:resolve proto go pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws
8-
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
98
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
10-
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
119
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc
12-
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
1310
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
11+
# gazelle:resolve proto pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws:aws_proto
12+
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
13+
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
14+
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
1415
gazelle(
1516
name = "gazelle",
1617
)

‎MODULE.bazel

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
module(name = "com_github_buildbarn_bb_autoscaler")
2+
3+
bazel_dep(name = "com_github_buildbarn_bb_remote_execution")
4+
bazel_dep(name = "com_github_buildbarn_bb_storage")
5+
bazel_dep(name = "com_github_buildbarn_go_xdr")
6+
bazel_dep(name = "gazelle", version = "0.35.0")
7+
bazel_dep(name = "jsonnet_go", version = "0.20.0", repo_name = "google_jsonnet_go")
8+
bazel_dep(name = "protobuf", version = "23.1")
9+
bazel_dep(name = "rules_go", version = "0.46.0")
10+
bazel_dep(name = "toolchains_llvm", version = "1.0.0")
11+
12+
git_override(
13+
module_name = "com_github_buildbarn_bb_remote_execution",
14+
commit = "efa691334b0c8b47c6fedd73c6ad434ba166c647",
15+
remote = "https://github.com/buildbarn/bb-remote-execution.git",
16+
)
17+
18+
git_override(
19+
module_name = "com_github_buildbarn_bb_storage",
20+
commit = "00c3edab9fbee741613670dc3c20404910b9076f",
21+
remote = "https://github.com/buildbarn/bb-storage.git",
22+
)
23+
24+
git_override(
25+
module_name = "com_github_buildbarn_go_xdr",
26+
commit = "9cb8426d3e09e301c2b12c993e54ef795a665a92",
27+
remote = "https://github.com/buildbarn/go-xdr.git",
28+
)
29+
30+
git_override(
31+
module_name = "gazelle",
32+
commit = "f5a5c5dc90b4d6a39f0f47d770eba27c6c1c1877",
33+
patches = ["//:patches/gazelle/googleapis.diff"],
34+
remote = "https://github.com/bazelbuild/bazel-gazelle.git",
35+
)
36+
37+
git_override(
38+
module_name = "rules_antlr",
39+
commit = "89a29cca479363a5aee53e203719510bdc6be6ff",
40+
patches = [
41+
"//:patches/rules_antlr/antlr-4.10.diff",
42+
"//:patches/rules_antlr/bzlmod.diff",
43+
],
44+
remote = "https://github.com/marcohu/rules_antlr.git",
45+
)
46+
47+
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
48+
go_deps.from_file(go_mod = "//:go.mod")
49+
use_repo(
50+
go_deps,
51+
"cc_mvdan_gofumpt",
52+
"com_github_aws_aws_sdk_go_v2",
53+
"com_github_aws_aws_sdk_go_v2_service_autoscaling",
54+
"com_github_aws_aws_sdk_go_v2_service_eks",
55+
"com_github_aws_aws_sdk_go_v2_service_sqs",
56+
"com_github_aws_smithy_go",
57+
"com_github_bazelbuild_buildtools",
58+
"com_github_bazelbuild_remote_apis",
59+
"com_github_golang_mock",
60+
"com_github_prometheus_client_golang",
61+
"com_github_prometheus_common",
62+
"com_github_stretchr_testify",
63+
"io_k8s_apimachinery",
64+
"io_k8s_client_go",
65+
"org_golang_google_grpc",
66+
"org_golang_google_protobuf",
67+
"org_golang_x_lint",
68+
)
69+
70+
go_deps_dev = use_extension("@gazelle//:extensions.bzl", "go_deps", dev_dependency = True)
71+
go_deps_dev.gazelle_override(
72+
build_file_generation = "on",
73+
directives = [
74+
"gazelle:resolve proto go build/bazel/semver/semver.proto //build/bazel/semver",
75+
"gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto_googleapis_api//annotations",
76+
"gazelle:resolve proto go google/longrunning/operations.proto @com_google_cloud_go_longrunning//autogen/longrunningpb",
77+
"gazelle:resolve proto go google/rpc/status.proto @org_golang_google_genproto_googleapis_rpc//status",
78+
"gazelle:resolve proto google/api/annotations.proto @googleapis//google/api:annotations_proto",
79+
"gazelle:resolve proto google/longrunning/operations.proto @googleapis//google/longrunning:operations_proto",
80+
"gazelle:resolve proto google/rpc/status.proto @googleapis//google/rpc:status_proto",
81+
],
82+
path = "github.com/bazelbuild/remote-apis",
83+
)
84+
go_deps_dev.module_override(
85+
patches = ["@com_github_buildbarn_bb_storage//:patches/com_github_grpc_ecosystem_go_grpc_prometheus/client-metrics-prevent-handled-twice.diff"],
86+
path = "github.com/grpc-ecosystem/go-grpc-prometheus",
87+
)
88+
89+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
90+
91+
http_archive(
92+
name = "io_bazel_rules_jsonnet",
93+
sha256 = "c51ba0dba41d667fa5c64e56e252ba54be093e5ae764af6470dabca901f373eb",
94+
strip_prefix = "rules_jsonnet-0.5.0",
95+
urls = ["https://github.com/bazelbuild/rules_jsonnet/archive/0.5.0.tar.gz"],
96+
)
97+
98+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True)
99+
llvm.toolchain(
100+
llvm_version = "14.0.0",
101+
)
102+
use_repo(llvm, "llvm_toolchain_llvm")

‎MODULE.bazel.lock

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

‎WORKSPACE

-211
This file was deleted.

‎cmd/bb_asg_lifecycle_hook/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official", "multiarch_go_image")
2-
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
load("@rules_go//go:def.bzl", "go_binary", "go_library")
33

44
go_library(
55
name = "bb_asg_lifecycle_hook_lib",

‎cmd/bb_autoscaler/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official", "multiarch_go_image")
2-
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
2+
load("@rules_go//go:def.bzl", "go_binary", "go_library")
33

44
go_library(
55
name = "bb_autoscaler_lib",

‎go.mod

+16-3
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,27 @@ require (
1111
github.com/aws/aws-sdk-go-v2/service/eks v1.27.14
1212
github.com/aws/aws-sdk-go-v2/service/sqs v1.23.2
1313
github.com/aws/smithy-go v1.19.0
14+
github.com/bazelbuild/buildtools v0.0.0-20240313121412-66c605173954
1415
github.com/bazelbuild/remote-apis v0.0.0-20240215191509-9ff14cecffe5
15-
github.com/buildbarn/bb-remote-execution v0.0.0-20240327120038-7bcf9b5f081f
16-
github.com/buildbarn/bb-storage v0.0.0-20240326045855-53c12526d34e
16+
github.com/buildbarn/bb-remote-execution v0.0.0-20240330212454-efa691334b0c
17+
github.com/buildbarn/bb-storage v0.0.0-20240330204725-00c3edab9fbe
18+
github.com/golang/mock v1.6.0
1719
github.com/prometheus/client_golang v1.18.0
1820
github.com/prometheus/common v0.45.0
21+
github.com/stretchr/testify v1.9.0
22+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
1923
google.golang.org/grpc v1.62.0
2024
google.golang.org/protobuf v1.32.0
2125
k8s.io/apimachinery v0.27.3
2226
k8s.io/client-go v0.27.3
27+
mvdan.cc/gofumpt v0.5.0
2328
)
2429

2530
require (
2631
cloud.google.com/go/compute v1.24.0 // indirect
2732
cloud.google.com/go/compute/metadata v0.2.3 // indirect
2833
cloud.google.com/go/longrunning v0.5.5 // indirect
34+
github.com/aohorodnyk/mimeheader v0.0.6 // indirect
2935
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect
3036
github.com/aws/aws-sdk-go-v2/config v1.26.2 // indirect
3137
github.com/aws/aws-sdk-go-v2/credentials v1.16.13 // indirect
@@ -46,6 +52,8 @@ require (
4652
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4753
github.com/davecgh/go-spew v1.1.1 // indirect
4854
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
55+
github.com/fsnotify/fsnotify v1.6.0 // indirect
56+
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
4957
github.com/go-logr/logr v1.4.1 // indirect
5058
github.com/go-logr/stdr v1.2.2 // indirect
5159
github.com/go-openapi/jsonpointer v0.19.6 // indirect
@@ -66,12 +74,14 @@ require (
6674
github.com/josharian/intern v1.0.0 // indirect
6775
github.com/json-iterator/go v1.1.12 // indirect
6876
github.com/mailru/easyjson v0.7.7 // indirect
69-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
77+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
7078
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7179
github.com/modern-go/reflect2 v1.0.2 // indirect
7280
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
81+
github.com/pmezard/go-difflib v1.0.0 // indirect
7382
github.com/prometheus/client_model v0.5.0 // indirect
7483
github.com/prometheus/procfs v0.12.0 // indirect
84+
github.com/sercand/kuberesolver/v5 v5.1.1 // indirect
7585
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
7686
go.opentelemetry.io/contrib/propagators/b3 v1.21.1 // indirect
7787
go.opentelemetry.io/otel v1.23.1 // indirect
@@ -81,13 +91,16 @@ require (
8191
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
8292
go.opentelemetry.io/otel/trace v1.23.1 // indirect
8393
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
94+
golang.org/x/crypto v0.18.0 // indirect
95+
golang.org/x/mod v0.10.0 // indirect
8496
golang.org/x/net v0.20.0 // indirect
8597
golang.org/x/oauth2 v0.16.0 // indirect
8698
golang.org/x/sync v0.6.0 // indirect
8799
golang.org/x/sys v0.18.0 // indirect
88100
golang.org/x/term v0.16.0 // indirect
89101
golang.org/x/text v0.14.0 // indirect
90102
golang.org/x/time v0.5.0 // indirect
103+
golang.org/x/tools v0.8.0 // indirect
91104
google.golang.org/appengine v1.6.8 // indirect
92105
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
93106
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect

‎go.sum

+128-123
Large diffs are not rendered by default.

‎go_dependencies.bzl

-1,818
This file was deleted.

‎internal/mock/BUILD.bazel

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# gazelle:ignore
22

3-
load("@io_bazel_rules_go//extras:gomock.bzl", "gomock")
4-
load("@io_bazel_rules_go//go:def.bzl", "go_library")
3+
load("@rules_go//extras:gomock.bzl", "gomock")
4+
load("@rules_go//go:def.bzl", "go_library")
55

66
gomock(
77
name = "buildqueuestate",
@@ -35,10 +35,7 @@ gomock(
3535
gomock(
3636
name = "storage_util",
3737
out = "storage_util.go",
38-
interfaces = [
39-
"ErrorLogger",
40-
"UUIDGenerator",
41-
],
38+
interfaces = ["ErrorLogger"],
4239
library = "@com_github_buildbarn_bb_storage//pkg/util",
4340
package = "mock",
4441
)
@@ -59,7 +56,6 @@ go_library(
5956
"@com_github_aws_smithy_go//:smithy-go",
6057
"@com_github_buildbarn_bb_remote_execution//pkg/proto/buildqueuestate",
6158
"@com_github_golang_mock//gomock",
62-
"@com_github_google_uuid//:uuid",
6359
"@org_golang_google_grpc//:grpc",
6460
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
6561
],

‎internal/mock/dummy.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package mock

‎patches/gazelle/googleapis.diff

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
diff --git MODULE.bazel MODULE.bazel
2+
index ba9c3c6..11e927b 100644
3+
--- MODULE.bazel
4+
+++ MODULE.bazel
5+
@@ -64,3 +64,5 @@ use_repo(
6+
go_sdk_dev,
7+
go_sdk = "go_default_sdk",
8+
)
9+
+
10+
+bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5")

‎patches/rules_antlr/antlr-4.10.diff

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
diff --git antlr/repositories.bzl antlr/repositories.bzl
2+
index e2525ab..12f79f0 100644
3+
--- antlr/repositories.bzl
4+
+++ antlr/repositories.bzl
5+
@@ -3,13 +3,18 @@
6+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar")
7+
load(":lang.bzl", "C", "CPP", "GO", "JAVA", "OBJC", "PYTHON", "PYTHON2", "PYTHON3", supportedLanguages = "supported")
8+
9+
-v4 = [4, "4.7.1", "4.7.2", "4.8"]
10+
+v4 = [4, "4.7.1", "4.7.2", "4.8", "4.10"]
11+
v4_opt = [4, "4.7.1", "4.7.2", "4.7.3", "4.7.4"]
12+
v3 = [3, "3.5.2"]
13+
v2 = [2, "2.7.7"]
14+
15+
PACKAGES = {
16+
"antlr": {
17+
+ "4.10": {
18+
+ "url": "https://github.com/antlr/antlr4/archive/4.10.tar.gz",
19+
+ "prefix": "antlr4-4.10",
20+
+ "sha256": "39b2604fc75fa77323bd7046f2fb750c818cf11fcce2cd6cca06b6697f60ffbb",
21+
+ },
22+
"4.8": {
23+
"url": "https://github.com/antlr/antlr4/archive/4.8.tar.gz",
24+
"prefix": "antlr4-4.8",
25+
@@ -38,6 +43,10 @@ PACKAGES = {
26+
},
27+
},
28+
"antlr4_runtime": {
29+
+ "4.10": {
30+
+ "path": "org/antlr/antlr4-runtime/4.10/antlr4-runtime-4.10.jar",
31+
+ "sha256": "4663a38f88e1935ea612336cbf34f702f10bd0af8e62715a9e959629f141654e",
32+
+ },
33+
"4.8": {
34+
"path": "org/antlr/antlr4-runtime/4.8/antlr4-runtime-4.8.jar",
35+
"sha256": "2337df5d81e715b39aeea07aac46ad47e4f1f9e9cd7c899f124f425913efdcf8",
36+
@@ -68,6 +77,10 @@ PACKAGES = {
37+
},
38+
},
39+
"antlr4_tool": {
40+
+ "4.10": {
41+
+ "path": "org/antlr/antlr4/4.10/antlr4-4.10.jar",
42+
+ "sha256": "f32485cfdf114295a58cd2005af9463706c5fd43d900118126eb3a9ac36bfec3",
43+
+ },
44+
"4.8": {
45+
"path": "org/antlr/antlr4/4.8/antlr4-4.8.jar",
46+
"sha256": "6e4477689371f237d4d8aa40642badbb209d4628ccdd81234d90f829a743bac8",
47+
@@ -179,7 +192,9 @@ def rules_antlr_dependencies(*versionsAndLanguages):
48+
languages = [JAVA]
49+
50+
for version in sorted(versions, key = _toString):
51+
- if version == 4 or version == "4.8":
52+
+ if version == 4 or version == "4.10":
53+
+ _antlr410_dependencies(languages)
54+
+ elif version == "4.8":
55+
_antlr48_dependencies(languages)
56+
elif version == "4.7.2":
57+
_antlr472_dependencies(languages)
58+
@@ -217,6 +232,19 @@ def rules_antlr_optimized_dependencies(version):
59+
else:
60+
fail('Unsupported ANTLR version provided: "{0}". Currently supported are: {1}'.format(version, v4_opt), attr = "version")
61+
62+
+def _antlr410_dependencies(languages):
63+
+ _antlr4_dependencies(
64+
+ "4.10",
65+
+ languages,
66+
+ {
67+
+ "antlr4_runtime": "4.10",
68+
+ "antlr4_tool": "4.10",
69+
+ "antlr3_runtime": "3.5.2",
70+
+ "stringtemplate4": "4.3",
71+
+ "javax_json": "1.0.4",
72+
+ },
73+
+ )
74+
+
75+
def _antlr48_dependencies(languages):
76+
_antlr4_dependencies(
77+
"4.8",

‎patches/rules_antlr/bzlmod.diff

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git MODULE.bazel MODULE.bazel
2+
new file mode 100644
3+
index 0000000..eb12741
4+
--- /dev/null
5+
+++ MODULE.bazel
6+
@@ -0,0 +1,14 @@
7+
+module(name = "rules_antlr")
8+
+
9+
+bazel_dep(name = "rules_java", version = "7.5.0")
10+
+
11+
+antlr = use_extension("//antlr:extensions.bzl", "antlr")
12+
+antlr.download(version = "4.8")
13+
+use_repo(
14+
+ antlr,
15+
+ "antlr3_runtime",
16+
+ "antlr4_runtime",
17+
+ "antlr4_tool",
18+
+ "javax_json",
19+
+ "stringtemplate4",
20+
+)
21+
diff --git antlr/extensions.bzl antlr/extensions.bzl
22+
new file mode 100644
23+
index 0000000..3151e01
24+
--- /dev/null
25+
+++ antlr/extensions.bzl
26+
@@ -0,0 +1,17 @@
27+
+load("//antlr:repositories.bzl", "rules_antlr_dependencies")
28+
+
29+
+download = tag_class(attrs = {"version": attr.string()})
30+
+
31+
+def _antlr(module_ctx):
32+
+ rules_antlr_dependencies(
33+
+ max([
34+
+ ([int(part) for part in download.version.split(".")], download.version)
35+
+ for mod in module_ctx.modules
36+
+ for download in mod.tags.download
37+
+ ])[1],
38+
+ )
39+
+
40+
+antlr = module_extension(
41+
+ implementation = _antlr,
42+
+ tag_classes = {"download": download},
43+
+)

‎pkg/autoscaler/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
1+
load("@rules_go//go:def.bzl", "go_library", "go_test")
22

33
go_library(
44
name = "autoscaler",

‎pkg/cloud/aws/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
1+
load("@rules_go//go:def.bzl", "go_library", "go_test")
22

33
go_library(
44
name = "aws",

‎pkg/proto/configuration/bb_asg_lifecycle_hook/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
load("@rules_go//proto:def.bzl", "go_proto_library")
13
load("@rules_proto//proto:defs.bzl", "proto_library")
2-
load("@io_bazel_rules_go//go:def.bzl", "go_library")
3-
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
44

55
proto_library(
66
name = "bb_asg_lifecycle_hook_proto",

‎pkg/proto/configuration/bb_asg_lifecycle_hook/bb_asg_lifecycle_hook.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pkg/proto/configuration/bb_autoscaler/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
load("@rules_go//proto:def.bzl", "go_proto_library")
13
load("@rules_proto//proto:defs.bzl", "proto_library")
2-
load("@io_bazel_rules_go//go:def.bzl", "go_library")
3-
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
44

55
proto_library(
66
name = "bb_autoscaler_proto",

‎pkg/proto/configuration/bb_autoscaler/bb_autoscaler.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tools/BUILD.bazel

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "tools",
5+
srcs = ["deps.go"],
6+
importpath = "github.com/buildbarn/bb-autoscaler/tools",
7+
tags = ["manual"],
8+
visibility = ["//visibility:public"],
9+
deps = [
10+
"@cc_mvdan_gofumpt//:gofumpt",
11+
"@com_github_bazelbuild_buildtools//buildifier",
12+
"@org_golang_x_lint//:lint",
13+
],
14+
)

‎tools/deps.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package tools
2+
3+
import (
4+
// Used by CI.
5+
_ "github.com/bazelbuild/buildtools/buildifier"
6+
// Used by CI.
7+
_ "golang.org/x/lint"
8+
// Used by CI.
9+
_ "mvdan.cc/gofumpt"
10+
)

‎tools/github_workflows/github_workflows.jsonnet

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local workflows_template = import 'external/com_github_buildbarn_bb_storage/tools/github_workflows/workflows_template.libsonnet';
1+
local workflows_template = import 'tools/github_workflows/workflows_template.libsonnet';
22

33
workflows_template.getWorkflows(
44
[

0 commit comments

Comments
 (0)
Please sign in to comment.