bazelbuild / remote-apis-sdks

This repository contains client libraries for the Remote Execution API https://github.com/bazelbuild/remote-apis
Apache License 2.0
49 stars 51 forks source link

Upgrading bazel to 7.0.2 and rules_go to v0.46.0 with latest remote-api-skds giving googleapis error #597

Open KhushbooJ opened 1 month ago

KhushbooJ commented 1 month ago

I have a golang project build with bazel which uses remote-api-sdks to do a grpc call to buildfarm-server. The project works with old sdk version but when I am trying to upgrade to a new bazel version (7.0.2), I am falling into a pit of issues, which I fixed one at a time to finally getting stuck with the below error :

COMMAND -- I:\bazel\bazel-7.0.2.exe build src:jb ['jb' is an internal command] OUTPUT -- ERROR: no such package '@@go_googleapis//google/bytestream': The repository '@@go_googleapis' could not be resolved: Repository '@@go_googleapis' is not defined ERROR: C:/users/e922103/_bazel_e922103/n3oja7sa/external/com_github_bazelbuild_remote_apis_sdks/go/pkg/client/BUILD.bazel:3:11: no such package '@@go_googleapis//google/bytestream': The repository '@@go_googleapis' could not be resolved: Repository '@@go_googleapis' is not defined and referenced by '@@com_github_bazelbuild_remote_apis_sdks//go/pkg/client:client' ERROR: Analysis of target '//src:jb' failed; build aborted: Analysis failed

Solutions tried : I have already upgraded to the latest remote-api-sdks code and had to update the rule_go as well to work with latest bazel version.

Here is WORKSPACE file entry for the sdk : git_repository( name = "com_github_bazelbuild_remote_apis_sdks", commit = "f4821a2a072c44f9af83002cf7a272fff8223fa3", remote = "https://github.com/bazelbuild/remote-apis-sdks.git", shallow_since = "1665783165 -0700", )

Here is my http_deps.bzl enteries :

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
    ],
)

http_archive(
    name = "com_github_bazelbuild_remote_apis",
    sha256 = "825f6439eb1dbda7b4e89037139044d7a87819209f9920f7d849f9f84f15dd84",
    strip_prefix = "remote-apis-3b4b6402103539d66fcdd1a4d945f660742665ca",
    urls = ["https://github.com/bazelbuild/remote-apis/archive/3b4b6402103539d66fcdd1a4d945f660742665ca.zip"],
)

# rules_proto is required for enabling the switched_rules_by_language macro
http_archive(
    name = "rules_proto",
    sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
    strip_prefix = "rules_proto-5.3.0-21.7",
    urls = [
        "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
    ],
)

# Needed for the googleapis protos used by com_github_bazelbuild_remote_apis
# below.
http_archive(
    name = "googleapis",
    build_file = "BUILD.googleapis",
    strip_prefix = "googleapis-7976ffadc0f21ee9149708c0c97ef000e15de1eb",
    urls = [https://github.com/googleapis/googleapis/archive/7976ffadc0f21ee9149708c0c97ef000e15de1eb.zip],
    sha256 = "935fb7ebbc65f43e293fac7240471c24d9d52249f5c8bf09c0d04327b2191053",
)

Please assist on the same as this is blocking the upgrade.

mrahs commented 1 month ago

Upgrading Bazel is on our radar but we don't have an ETA yet. Meanwhile, you can take a look at how reclient (which is on Bazel 7.1.1) imports the SDK for an example.