Skip to content

Commit 2489fbc

Browse files
committed
Migrate bb-autoscaler to bzlmod
1 parent df1ebf1 commit 2489fbc

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
)

0 commit comments

Comments
 (0)