Skip to content

Commit faa2f75

Browse files
committed
Bring WORKSPACE in sync with other repositories
This ensures that the container images in this project are also built for ARM64.
1 parent 19862fe commit faa2f75

File tree

12 files changed

+637
-536
lines changed

12 files changed

+637
-536
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
build --host_cxxopt=-std=c++17
12
run --workspace_status_command="bash tools/workspace-status.sh"

.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.4.0

.github/workflows/master.yaml

+8-12
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@
33
"build_and_test": {
44
"runs-on": "ubuntu-latest",
55
"steps": [
6-
{
7-
"name": "Installing Bazel",
8-
"run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
9-
},
106
{
117
"name": "Check out source code",
128
"uses": "actions/checkout@v1"
139
},
1410
{
15-
"name": "Restore Bazel cache",
16-
"uses": "actions/cache@v1",
17-
"with": {
18-
"key": "bazel",
19-
"path": "~/.cache/bazel"
20-
}
11+
"name": "Installing Bazel",
12+
"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}"
2113
},
2214
{
2315
"name": "Gazelle",
@@ -41,11 +33,15 @@
4133
},
4234
{
4335
"name": "Protobuf generation",
44-
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
36+
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query --output=label 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
37+
},
38+
{
39+
"name": "Embedded asset generation",
40+
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|' | sort -u)\ngit grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |\\1/|' | while read o; do\n if [ -e \"bazel-bin/$o\" ]; then\n rm -rf \"$o\"\n cp -r \"bazel-bin/$o\" \"$o\"\n find \"$o\" -type f -exec chmod -x {} +\n fi\ndone\n"
4541
},
4642
{
4743
"name": "Test style conformance",
48-
"run": "git diff --exit-code HEAD --"
44+
"run": "git add . && git diff --exit-code HEAD --"
4945
},
5046
{
5147
"name": "Golint",

.github/workflows/pull-requests.yaml

+8-12
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@
33
"build_and_test": {
44
"runs-on": "ubuntu-latest",
55
"steps": [
6-
{
7-
"name": "Installing Bazel",
8-
"run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
9-
},
106
{
117
"name": "Check out source code",
128
"uses": "actions/checkout@v1"
139
},
1410
{
15-
"name": "Restore Bazel cache",
16-
"uses": "actions/cache@v1",
17-
"with": {
18-
"key": "bazel",
19-
"path": "~/.cache/bazel"
20-
}
11+
"name": "Installing Bazel",
12+
"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}"
2113
},
2214
{
2315
"name": "Gazelle",
@@ -41,11 +33,15 @@
4133
},
4234
{
4335
"name": "Protobuf generation",
44-
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
36+
"run": "find . bazel-bin/pkg/proto -name '*.pb.go' -delete || true\nbazel build $(bazel query --output=label 'kind(\"go_proto_library\", //...)')\nfind bazel-bin/pkg/proto -name '*.pb.go' | while read f; do\n cat $f > $(echo $f | sed -e 's|.*/pkg/proto/|pkg/proto/|')\ndone\n"
37+
},
38+
{
39+
"name": "Embedded asset generation",
40+
"run": "bazel build $(git grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |//\\1:|' | sort -u)\ngit grep '^[[:space:]]*//go:embed ' | sed -e 's|\\(.*\\)/.*//go:embed |\\1/|' | while read o; do\n if [ -e \"bazel-bin/$o\" ]; then\n rm -rf \"$o\"\n cp -r \"bazel-bin/$o\" \"$o\"\n find \"$o\" -type f -exec chmod -x {} +\n fi\ndone\n"
4541
},
4642
{
4743
"name": "Test style conformance",
48-
"run": "git diff --exit-code HEAD --"
44+
"run": "git add . && git diff --exit-code HEAD --"
4945
},
5046
{
5147
"name": "Golint",

WORKSPACE

+72-32
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,47 @@ workspace(name = "com_github_buildbarn_bb_autoscaler")
33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

55
http_archive(
6-
name = "io_bazel_rules_docker",
7-
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
8-
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
6+
name = "rules_pkg",
7+
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
8+
urls = [
9+
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
10+
"https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
11+
],
12+
)
13+
14+
http_archive(
15+
name = "aspect_bazel_lib",
16+
sha256 = "6c25c59581041ede31e117693047f972cc4700c89acf913658dc89d04c338f8d",
17+
strip_prefix = "bazel-lib-2.5.3",
18+
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.3/bazel-lib-v2.5.3.tar.gz",
19+
)
20+
21+
load("@aspect_bazel_lib//lib:repositories.bzl", "register_expand_template_toolchains")
22+
23+
register_expand_template_toolchains()
24+
25+
http_archive(
26+
name = "rules_oci",
27+
sha256 = "4a276e9566c03491649eef63f27c2816cc222f41ccdebd97d2c5159e84917c3b",
28+
strip_prefix = "rules_oci-1.7.4",
29+
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.7.4/rules_oci-v1.7.4.tar.gz",
930
)
1031

1132
http_archive(
1233
name = "io_bazel_rules_go",
13-
sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d",
34+
sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
1435
urls = [
15-
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
16-
"https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
36+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
37+
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
1738
],
1839
)
1940

2041
http_archive(
2142
name = "bazel_gazelle",
22-
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
43+
sha256 = "b7387f72efb59f876e4daae42f1d3912d0d45563eac7cb23d1de0b094ab588cf",
2344
urls = [
24-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
25-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
45+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
46+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.34.0/bazel-gazelle-v0.34.0.tar.gz",
2647
],
2748
)
2849

@@ -49,23 +70,29 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
4970

5071
go_rules_dependencies()
5172

52-
go_register_toolchains(version = "1.20.1")
53-
54-
load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")
55-
56-
container_repositories()
57-
58-
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
59-
60-
container_deps()
73+
go_register_toolchains(version = "1.21.5")
6174

6275
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
6376

6477
gazelle_dependencies()
6578

66-
load("@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories")
79+
load("@rules_oci//oci:pull.bzl", "oci_pull")
80+
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_toolchains")
81+
82+
oci_register_toolchains(
83+
name = "oci",
84+
crane_version = LATEST_CRANE_VERSION,
85+
)
6786

68-
_go_image_repos()
87+
oci_pull(
88+
name = "distroless_static",
89+
digest = "sha256:7e5c6a2a4ae854242874d36171b31d26e0539c98fc6080f942f16b03e82851ab",
90+
image = "gcr.io/distroless/static",
91+
platforms = [
92+
"linux/amd64",
93+
"linux/arm64/v8",
94+
],
95+
)
6996

7097
load("@com_github_bazelbuild_remote_apis//:repository_rules.bzl", "switched_rules_by_language")
7198

@@ -76,24 +103,37 @@ switched_rules_by_language(
76103

77104
http_archive(
78105
name = "com_google_protobuf",
79-
sha256 = "ba0650be1b169d24908eeddbe6107f011d8df0da5b1a5a4449a913b10e578faf",
80-
strip_prefix = "protobuf-3.19.4",
81-
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protobuf-all-3.19.4.tar.gz"],
106+
sha256 = "a700a49470d301f1190a487a923b5095bf60f08f4ae4cac9f5f7c36883d17971",
107+
strip_prefix = "protobuf-23.4",
108+
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protobuf-23.4.tar.gz"],
82109
)
83110

84111
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
85112

86113
protobuf_deps()
87114

88115
http_archive(
89-
name = "com_grail_bazel_toolchain",
90-
canonical_id = "0.7.2",
91-
sha256 = "f7aa8e59c9d3cafde6edb372d9bd25fb4ee7293ab20b916d867cd0baaa642529",
92-
strip_prefix = "bazel-toolchain-0.7.2",
93-
url = "https://github.com/grailbio/bazel-toolchain/archive/0.7.2.tar.gz",
116+
name = "googleapis",
117+
sha256 = "361e26593b881e70286a28065859c941e25b96f9c48ba91127293d0a881152d6",
118+
strip_prefix = "googleapis-a3770599794a8d319286df96f03343b6cd0e7f4f",
119+
urls = ["https://github.com/googleapis/googleapis/archive/a3770599794a8d319286df96f03343b6cd0e7f4f.zip"],
120+
)
121+
122+
load("@googleapis//:repository_rules.bzl", "switched_rules_by_language")
123+
124+
switched_rules_by_language(
125+
name = "com_google_googleapis_imports",
126+
)
127+
128+
http_archive(
129+
name = "toolchains_llvm",
130+
canonical_id = "0.10.3",
131+
sha256 = "b7cd301ef7b0ece28d20d3e778697a5e3b81828393150bed04838c0c52963a01",
132+
strip_prefix = "toolchains_llvm-0.10.3",
133+
url = "https://github.com/grailbio/bazel-toolchain/releases/download/0.10.3/toolchains_llvm-0.10.3.tar.gz",
94134
)
95135

96-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
136+
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
97137

98138
llvm_toolchain(
99139
name = "llvm_toolchain",
@@ -129,9 +169,9 @@ http_archive(
129169

130170
http_archive(
131171
name = "aspect_rules_js",
132-
sha256 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
133-
strip_prefix = "rules_js-1.23.0",
134-
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.0.tar.gz",
172+
sha256 = "63cf42b07aae34904447c74f5b41652c4933984cc325726673a5e4561d9789e7",
173+
strip_prefix = "rules_js-1.39.1",
174+
url = "https://github.com/aspect-build/rules_js/releases/download/v1.39.1/rules_js-v1.39.1.tar.gz",
135175
)
136176

137177
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

cmd/bb_asg_lifecycle_hook/BUILD.bazel

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official")
2-
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
1+
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official", "multiarch_go_image")
32
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
43

54
go_library(
@@ -28,11 +27,9 @@ go_binary(
2827
visibility = ["//visibility:public"],
2928
)
3029

31-
go_image(
30+
multiarch_go_image(
3231
name = "bb_asg_lifecycle_hook_container",
33-
embed = [":bb_asg_lifecycle_hook_lib"],
34-
pure = "on",
35-
visibility = ["//visibility:public"],
32+
binary = ":bb_asg_lifecycle_hook",
3633
)
3734

3835
container_push_official(

cmd/bb_autoscaler/BUILD.bazel

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official")
2-
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
1+
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official", "multiarch_go_image")
32
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
43

54
go_library(
@@ -38,11 +37,9 @@ go_binary(
3837
visibility = ["//visibility:public"],
3938
)
4039

41-
go_image(
40+
multiarch_go_image(
4241
name = "bb_autoscaler_container",
43-
embed = [":bb_autoscaler_lib"],
44-
pure = "on",
45-
visibility = ["//visibility:public"],
42+
binary = ":bb_autoscaler",
4643
)
4744

4845
container_push_official(

0 commit comments

Comments
 (0)