Skip to content

Commit

Permalink
Migrate bb-autoscaler to bzlmod
Browse files Browse the repository at this point in the history
  • Loading branch information
EdSchouten committed Mar 31, 2024
1 parent df1ebf1 commit 2489fbc
Show file tree
Hide file tree
Showing 26 changed files with 13,110 additions and 2,215 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
7.1.1
56 changes: 30 additions & 26 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
"name": "Installing Bazel",
"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}"
},
{
"name": "Bazel mod tidy",
"run": "bazel mod tidy"
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
"run": "rm $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
},
{
"name": "Buildifier",
"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"
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
},
{
"name": "Gofmt",
Expand Down Expand Up @@ -49,11 +53,11 @@
},
{
"name": "linux_amd64: build and test",
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
},
{
"name": "linux_amd64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "linux_amd64: upload bb_asg_lifecycle_hook",
Expand All @@ -65,7 +69,7 @@
},
{
"name": "linux_amd64: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "linux_amd64: upload bb_autoscaler",
Expand All @@ -77,11 +81,11 @@
},
{
"name": "linux_386: build and test",
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
},
{
"name": "linux_386: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "linux_386: upload bb_asg_lifecycle_hook",
Expand All @@ -93,7 +97,7 @@
},
{
"name": "linux_386: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_386 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "linux_386: upload bb_autoscaler",
Expand All @@ -105,11 +109,11 @@
},
{
"name": "linux_arm: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
},
{
"name": "linux_arm: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "linux_arm: upload bb_asg_lifecycle_hook",
Expand All @@ -121,7 +125,7 @@
},
{
"name": "linux_arm: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "linux_arm: upload bb_autoscaler",
Expand All @@ -133,11 +137,11 @@
},
{
"name": "linux_arm64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
},
{
"name": "linux_arm64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "linux_arm64: upload bb_asg_lifecycle_hook",
Expand All @@ -149,7 +153,7 @@
},
{
"name": "linux_arm64: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:linux_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "linux_arm64: upload bb_autoscaler",
Expand All @@ -161,11 +165,11 @@
},
{
"name": "darwin_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
},
{
"name": "darwin_amd64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "darwin_amd64: upload bb_asg_lifecycle_hook",
Expand All @@ -177,7 +181,7 @@
},
{
"name": "darwin_amd64: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "darwin_amd64: upload bb_autoscaler",
Expand All @@ -189,11 +193,11 @@
},
{
"name": "darwin_arm64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
},
{
"name": "darwin_arm64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "darwin_arm64: upload bb_asg_lifecycle_hook",
Expand All @@ -205,7 +209,7 @@
},
{
"name": "darwin_arm64: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:darwin_arm64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "darwin_arm64: upload bb_autoscaler",
Expand All @@ -217,11 +221,11 @@
},
{
"name": "freebsd_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
},
{
"name": "freebsd_amd64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "freebsd_amd64: upload bb_asg_lifecycle_hook",
Expand All @@ -233,7 +237,7 @@
},
{
"name": "freebsd_amd64: copy bb_autoscaler",
"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"
"run": "rm -f bb_autoscaler && bazel run --run_under cp --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_autoscaler $(pwd)/bb_autoscaler"
},
{
"name": "freebsd_amd64: upload bb_autoscaler",
Expand All @@ -245,11 +249,11 @@
},
{
"name": "windows_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
},
{
"name": "windows_amd64: copy bb_asg_lifecycle_hook",
"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"
"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"
},
{
"name": "windows_amd64: upload bb_asg_lifecycle_hook",
Expand All @@ -261,7 +265,7 @@
},
{
"name": "windows_amd64: copy bb_autoscaler",
"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"
"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"
},
{
"name": "windows_amd64: upload bb_autoscaler",
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
"name": "Installing Bazel",
"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}"
},
{
"name": "Bazel mod tidy",
"run": "bazel mod tidy"
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
"run": "rm $(find . -name '*.pb.go' | sed -e 's/[^/]*$/BUILD.bazel/') && bazel run //:gazelle"
},
{
"name": "Buildifier",
"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"
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
},
{
"name": "Gofmt",
Expand Down Expand Up @@ -49,35 +53,35 @@
},
{
"name": "linux_amd64: build and test",
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_amd64 //..."
},
{
"name": "linux_386: build and test",
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
"run": "bazel test --test_output=errors --platforms=@rules_go//go/toolchain:linux_386 //..."
},
{
"name": "linux_arm: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm //..."
},
{
"name": "linux_arm64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_arm64 //..."
},
{
"name": "darwin_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_amd64 //..."
},
{
"name": "darwin_arm64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:darwin_arm64 //..."
},
{
"name": "freebsd_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
"run": "bazel build --platforms=@rules_go//go/toolchain:freebsd_amd64 //cmd/bb_asg_lifecycle_hook //cmd/bb_autoscaler"
},
{
"name": "windows_amd64: build and test",
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //..."
"run": "bazel build --platforms=@rules_go//go/toolchain:windows_amd64 //..."
}
]
}
Expand Down
11 changes: 6 additions & 5 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@gazelle//:def.bzl", "gazelle")

# gazelle:go_naming_convention_external import
# gazelle:prefix github.com/buildbarn/bb-autoscaler
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:execution
# gazelle:resolve proto pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws:aws_proto
# gazelle:resolve proto go pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
# gazelle:resolve proto pkg/proto/configuration/cloud/aws/aws.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/cloud/aws:aws_proto
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
gazelle(
name = "gazelle",
)
Loading

0 comments on commit 2489fbc

Please sign in to comment.