Skip to content

Commit 52b25db

Browse files
authored
Update dependencies, buildbarn ecosystem to latest (#29)
This change brings bb-remote-asset up-to-date with bb-storage/bb-remote-execution, so that nominally they may be able to use compatible configs, and likely inherit the other benefits (more recent toolchain, better bazel integration, etc.) This is done largely by copying `WORKSPACE` from bb-storage, making sure to match versions and orderings to ensure that the same versions of dependencies are loaded. Other transforms/migrations that proved necessary:0000 * `HTTPClient` was eliminated from bb-storage; mocking had to be done on a `http.RoundTripper` instead, in the same manner as buildbarn/bb-storage@b9951ac * Addition of structured concurrency to main, similar to buildbarn/bb-storage@4f243ea * Addition of `http.ClientConfiguration` proto options to `HttpFetcherConfiguration` * `bazel.canonical_id` added to the list of supported qualifiers, which prevents errors in some (most?) WORKSPACE configurations Tested: * `bazel test //...` with buildbarn/bb-storage#170 works on my system * Seems to work as expected when integrated with the bb-deployments docker-compose setup as in buildbarn/bb-deployments#91
1 parent 6a6e6f9 commit 52b25db

34 files changed

+2498
-1172
lines changed

.github/workflows/master.yaml

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
11
{
22
"jobs": {
33
"build_and_test": {
4-
"container": "docker://l.gcr.io/google/bazel:3.3.1",
54
"runs-on": "ubuntu-latest",
65
"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+
},
710
{
811
"name": "Check out source code",
912
"uses": "actions/checkout@v1"
1013
},
1114
{
12-
"name": "Buildifier",
13-
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
15+
"name": "Restore Bazel cache",
16+
"uses": "actions/cache@v1",
17+
"with": {
18+
"key": "bazel",
19+
"path": "~/.cache/bazel"
20+
}
1421
},
1522
{
1623
"name": "Gazelle",
1724
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
1825
},
26+
{
27+
"name": "Buildifier",
28+
"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"
29+
},
1930
{
2031
"name": "Gofmt",
21-
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -s -w -extra $(pwd)"
32+
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -lang 1.19 -w -extra $(pwd)"
2233
},
2334
{
2435
"name": "Clang format",
25-
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain//:bin/clang-format -- -i {} +"
36+
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +"
2637
},
2738
{
2839
"name": "GitHub workflows",
29-
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/* .github/workflows"
40+
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows"
41+
},
42+
{
43+
"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"
3045
},
3146
{
3247
"name": "Test style conformance",
@@ -36,17 +51,13 @@
3651
"name": "Golint",
3752
"run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
3853
},
39-
{
40-
"name": "Check for ineffective assignments",
41-
"run": "bazel run @com_github_gordonklaus_ineffassign//:ineffassign $(pwd)"
42-
},
4354
{
4455
"name": "linux_amd64: build and test",
45-
"run": "bazel test --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
56+
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
4657
},
4758
{
4859
"name": "linux_amd64: copy bb_remote_asset",
49-
"run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
60+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
5061
},
5162
{
5263
"name": "linux_amd64: upload bb_remote_asset",
@@ -56,13 +67,61 @@
5667
"path": "bb_remote_asset"
5768
}
5869
},
70+
{
71+
"name": "linux_386: build and test",
72+
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
73+
},
74+
{
75+
"name": "linux_386: copy bb_remote_asset",
76+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
77+
},
78+
{
79+
"name": "linux_386: upload bb_remote_asset",
80+
"uses": "actions/upload-artifact@v2-preview",
81+
"with": {
82+
"name": "bb_remote_asset.linux_386",
83+
"path": "bb_remote_asset"
84+
}
85+
},
86+
{
87+
"name": "linux_arm: build and test",
88+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
89+
},
90+
{
91+
"name": "linux_arm: copy bb_remote_asset",
92+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
93+
},
94+
{
95+
"name": "linux_arm: upload bb_remote_asset",
96+
"uses": "actions/upload-artifact@v2-preview",
97+
"with": {
98+
"name": "bb_remote_asset.linux_arm",
99+
"path": "bb_remote_asset"
100+
}
101+
},
102+
{
103+
"name": "linux_arm64: build and test",
104+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
105+
},
106+
{
107+
"name": "linux_arm64: copy bb_remote_asset",
108+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
109+
},
110+
{
111+
"name": "linux_arm64: upload bb_remote_asset",
112+
"uses": "actions/upload-artifact@v2-preview",
113+
"with": {
114+
"name": "bb_remote_asset.linux_arm64",
115+
"path": "bb_remote_asset"
116+
}
117+
},
59118
{
60119
"name": "darwin_amd64: build and test",
61120
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
62121
},
63122
{
64123
"name": "darwin_amd64: copy bb_remote_asset",
65-
"run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
124+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
66125
},
67126
{
68127
"name": "darwin_amd64: upload bb_remote_asset",
@@ -72,13 +131,29 @@
72131
"path": "bb_remote_asset"
73132
}
74133
},
134+
{
135+
"name": "darwin_arm64: build and test",
136+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
137+
},
138+
{
139+
"name": "darwin_arm64: copy bb_remote_asset",
140+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
141+
},
142+
{
143+
"name": "darwin_arm64: upload bb_remote_asset",
144+
"uses": "actions/upload-artifact@v2-preview",
145+
"with": {
146+
"name": "bb_remote_asset.darwin_arm64",
147+
"path": "bb_remote_asset"
148+
}
149+
},
75150
{
76151
"name": "freebsd_amd64: build and test",
77152
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset"
78153
},
79154
{
80155
"name": "freebsd_amd64: copy bb_remote_asset",
81-
"run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
156+
"run": "rm -f bb_remote_asset && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset"
82157
},
83158
{
84159
"name": "freebsd_amd64: upload bb_remote_asset",
@@ -94,7 +169,7 @@
94169
},
95170
{
96171
"name": "windows_amd64: copy bb_remote_asset",
97-
"run": "bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset.exe"
172+
"run": "rm -f bb_remote_asset.exe && bazel run --run_under cp --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/bb_remote_asset $(pwd)/bb_remote_asset.exe"
98173
},
99174
{
100175
"name": "windows_amd64: upload bb_remote_asset",
@@ -106,14 +181,14 @@
106181
},
107182
{
108183
"env": {
109-
"DOCKER_CONFIG_JSON": "${{ secrets.DOCKER_CONFIG_JSON }}"
184+
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
110185
},
111186
"name": "Install Docker credentials",
112-
"run": "mkdir ~/.docker && echo \"${DOCKER_CONFIG_JSON}\" > ~/.docker/config.json"
187+
"run": "echo \"${GITHUB_TOKEN}\" | docker login ghcr.io -u $ --password-stdin"
113188
},
114189
{
115190
"name": "Push container bb_remote_asset:bb_remote_asset",
116-
"run": "bazel run //cmd/bb_remote_asset:bb_remote_asset_container_push"
191+
"run": "bazel run --stamp //cmd/bb_remote_asset:bb_remote_asset_container_push"
117192
}
118193
]
119194
}

.github/workflows/pull-requests.yaml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
11
{
22
"jobs": {
33
"build_and_test": {
4-
"container": "docker://l.gcr.io/google/bazel:3.3.1",
54
"runs-on": "ubuntu-latest",
65
"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+
},
710
{
811
"name": "Check out source code",
912
"uses": "actions/checkout@v1"
1013
},
1114
{
12-
"name": "Buildifier",
13-
"run": "bazel run @com_github_bazelbuild_buildtools//:buildifier"
15+
"name": "Restore Bazel cache",
16+
"uses": "actions/cache@v1",
17+
"with": {
18+
"key": "bazel",
19+
"path": "~/.cache/bazel"
20+
}
1421
},
1522
{
1623
"name": "Gazelle",
1724
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
1825
},
26+
{
27+
"name": "Buildifier",
28+
"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"
29+
},
1930
{
2031
"name": "Gofmt",
21-
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -s -w -extra $(pwd)"
32+
"run": "bazel run @cc_mvdan_gofumpt//:gofumpt -- -lang 1.19 -w -extra $(pwd)"
2233
},
2334
{
2435
"name": "Clang format",
25-
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain//:bin/clang-format -- -i {} +"
36+
"run": "find . -name '*.proto' -exec bazel run @llvm_toolchain_llvm//:bin/clang-format -- -i {} +"
2637
},
2738
{
2839
"name": "GitHub workflows",
29-
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/* .github/workflows"
40+
"run": "bazel build //tools/github_workflows && cp bazel-bin/tools/github_workflows/*.yaml .github/workflows"
41+
},
42+
{
43+
"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"
3045
},
3146
{
3247
"name": "Test style conformance",
@@ -37,17 +52,29 @@
3752
"run": "bazel run @org_golang_x_lint//golint -- -set_exit_status $(pwd)/..."
3853
},
3954
{
40-
"name": "Check for ineffective assignments",
41-
"run": "bazel run @com_github_gordonklaus_ineffassign//:ineffassign $(pwd)"
55+
"name": "linux_amd64: build and test",
56+
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
4257
},
4358
{
44-
"name": "linux_amd64: build and test",
45-
"run": "bazel test --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //..."
59+
"name": "linux_386: build and test",
60+
"run": "bazel test --test_output=errors --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //..."
61+
},
62+
{
63+
"name": "linux_arm: build and test",
64+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm //..."
65+
},
66+
{
67+
"name": "linux_arm64: build and test",
68+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //..."
4669
},
4770
{
4871
"name": "darwin_amd64: build and test",
4972
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //..."
5073
},
74+
{
75+
"name": "darwin_arm64: build and test",
76+
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //..."
77+
},
5178
{
5279
"name": "freebsd_amd64: build and test",
5380
"run": "bazel build --platforms=@io_bazel_rules_go//go/toolchain:freebsd_amd64 //cmd/bb_remote_asset"

BUILD.bazel

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
load("@bazel_gazelle//:def.bzl", "gazelle")
22
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
3+
load("@npm//:defs.bzl", "npm_link_all_packages")
34

45
# gazelle:prefix github.com/buildbarn/bb-remote-asset
56
# gazelle:resolve proto build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:remote_execution_proto
6-
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library
7+
# gazelle:resolve proto go build/bazel/remote/execution/v2/remote_execution.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:execution
78
# gazelle:resolve proto build/bazel/remote/asset/v1/remote_asset.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/asset/v1:remote_asset_proto
8-
# gazelle:resolve proto go build/bazel/remote/asset/v1/remote_asset.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/asset/v1:go_default_library
9+
# gazelle:resolve proto go build/bazel/remote/asset/v1/remote_asset.proto @com_github_bazelbuild_remote_apis//build/bazel/remote/asset/v1:asset
910
# gazelle:resolve proto pkg/proto/configuration/blobstore/blobstore.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/blobstore:blobstore_proto
10-
# gazelle:resolve proto go pkg/proto/configuration/blobstore/blobstore.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/blobstore:go_default_library
11+
# gazelle:resolve proto go pkg/proto/configuration/blobstore/blobstore.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/blobstore
1112
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
12-
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:go_default_library
13+
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
1314
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
14-
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:go_default_library
15+
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc
16+
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
17+
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
18+
# gazelle:resolve proto opentelemetry/proto/common/v1/common.proto @io_opentelemetry_proto//:common_proto
19+
# gazelle:resolve proto go opentelemetry/proto/common/v1/common.proto @io_opentelemetry_go_proto_otlp//common/v1:common
1520
gazelle(
1621
name = "gazelle",
1722
)
1823

1924
buildifier(
2025
name = "buildifier",
2126
)
27+
28+
npm_link_all_packages(
29+
name = "node_modules",
30+
)

0 commit comments

Comments
 (0)