Skip to content

Commit

Permalink
go: Add bb-remote-execution dependency (#898)
Browse files Browse the repository at this point in the history
`github.com/buildbarn/bb-remote-execution` defines an RPC service that we'd like to implement. We can:

* depend on this repo as a dependency to use the protos within
* copy the protos and their transitive imports into enkit and author our own BUILD files

This change attempts to do the former. This came with some complications:

* Pulling in this dep upgraded GCP modules under `cloud.google.com/go`, which causes issues due to the [genproto migration](https://code.googlesource.com/gocloud/+/refs/heads/main/migration.md) that is currently underway. To resolve this, this PR:
  * runs the fixer tool on our code to update import paths, plus gazelle to fix BUILD files
  * pulls in a fork of `GoogleCloudPlatform/cloud-build-notifiers`, with updated deps and import paths (once GoogleCloudPlatform/cloud-build-notifiers#163 is merged, this fork can be dropped)
  * pulls in an updated version of `go_googleapis`. Usually `rules_go` does this for us, but we needed new datastore protos to be compatible with the updated datastore module, and so we must specify the version ourselves and also generate the patches that `rules_go` usually does.
* `github.com/bazelbuild/remote-apis` has BUILD files that reference `@googleapis` instead of `@go_googleapis`; this is usually patched in the buildbarn ecosystem, but we can't use that patch verbatim due to our updated version of `@go_googleapis` - so this change adds a slightly modified version of this patch.

Tested: `bazel test //... -k` works
  • Loading branch information
minor-fixes authored Apr 24, 2023
1 parent 89092b3 commit e26980b
Show file tree
Hide file tree
Showing 13 changed files with 168,372 additions and 3,350 deletions.
12 changes: 6 additions & 6 deletions bazel/dependencies/datastore_query_toproto_exported.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/query.go b/query.go
index f2e6d9c2a..1d6c69a6d 100644
index 0c3fe01db8..57f63f165a 100644
--- a/query.go
+++ b/query.go
@@ -331,6 +331,12 @@ func (q *Query) End(c Cursor) *Query {
return q
@@ -380,6 +380,12 @@ func (q *Query) toRunQueryRequest(req *pb.RunQueryRequest) error {
return nil
}

+// ENFABRICA PATCH
+// Export toProto for use in unit tests
+func (q *Query) ToProto(req *pb.RunQueryRequest) error {
+ return q.toProto(req)
+ return q.toRunQueryRequest(req)
+}
+
// toProto converts the query to a protocol buffer.
func (q *Query) toProto(req *pb.RunQueryRequest) error {
func (q *Query) toProto() (*pb.Query, error) {
if len(q.projection) != 0 && q.keysOnly {
return nil, errors.New("datastore: query cannot both project and be keys-only")
15 changes: 15 additions & 0 deletions bazel/dependencies/googleapis/add_directives.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -urN b/BUILD.bazel c/BUILD.bazel
--- b/BUILD.bazel 1969-12-31 16:00:00
+++ c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
@@ -0,0 +1,6 @@
+# gazelle:go_naming_convention import_alias
+# gazelle:proto package
+# gazelle:proto_group go_package
+# gazelle:exclude gapic
+# gazelle:exclude third_party
+# gazelle:exclude google/example/endpointsapis/goapp
diff -urN b/google/BUILD.bazel c/google/BUILD.bazel
--- b/google/BUILD.bazel 1969-12-31 16:00:00
+++ c/google/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
@@ -0,0 +1 @@
+# gazelle:prefix google.golang.org/genproto/googleapis
Loading

0 comments on commit e26980b

Please sign in to comment.