cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.88k stars 3.77k forks source link

ui: ./dev gen js produces error and `crdb-api-client` is not buildable #129369

Open dhartunian opened 3 weeks ago

dhartunian commented 3 weeks ago

Running gen js hits an error in ui.go that appears to be produced when copying files around.

❯ ./dev gen js
$ bazel build //pkg/ui/workspaces/eslint-plugin-crdb:eslint-plugin-crdb-lib //pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client //pkg/ui/workspaces/cluster-ui:ts_project
INFO: Invocation ID: 5df9486d-ebc1-40ae-a385-5f72fe0dcf98
INFO: Analyzed 3 targets (0 packages loaded, 0 targets configured).
INFO: Found 3 targets...
INFO: Elapsed time: 1.885s, Critical Path: 0.64s
INFO: 4 processes: 3 remote cache hit, 1 internal.
INFO: Build completed successfully, 4 total actions
ERROR: Rel: can't make  relative to /private/var/tmp/_bazel_davidh/d61affdd093572eb0c41c4220c20a747/execroot/com_github_cockroachdb_cockroach/bazel-out/darwin_arm64-fastbuild/bin/pkg/ui/workspaces/eslint-plugin-crdb/dist

It has also been producing this error (known issue with crdb-api-client not being buildable)

INFO: Analyzed target //pkg/ui/workspaces/crdb-api-client:crdb-api-client (0 packages loaded, 36 targets configured).
ERROR: /Users/xinhao/go/src/github.com/cockroachdb/cockroach/pkg/ui/workspaces/crdb-api-client/BUILD.bazel:11:8: output 'pkg/ui/workspaces/crdb-api-client/dist' of //pkg/ui/workspaces/crdb-api-client:protos is a directory but was not declared as such
ERROR: /Users/xinhao/go/src/github.com/cockroachdb/cockroach/pkg/ui/workspaces/crdb-api-client/BUILD.bazel:11:8: Executing genrule //pkg/ui/workspaces/crdb-api-client:protos failed: not all outputs were created or valid

Jira issue: CRDB-41507

Epic CRDB-37557

blathers-crl[bot] commented 3 weeks ago

Hi @dhartunian, please add branch-* labels to identify which branch(es) this C-bug affects.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

rickystewart commented 3 weeks ago

I think the Bazel 7 upgrade broke some stuff. I bisected it down to 0702e865fec87b4afa1254aa9c43b6b644c23771 (the Bazel 7 upgrade commit)

dhartunian commented 3 weeks ago

Thanks @rickystewart. I also filed this one which I think is related: https://github.com/cockroachdb/cockroach/issues/129374

Sorry the protobuf generation for the frontend is a bit of a minefield. I'd be eager to find some simplifications here. Happy to discuss further when I'm back from PTO in a few weeks, but otherwise feel free to pick these up.

rickystewart commented 3 weeks ago

The problem here is that pkg/ui/workspaces/crdb-api-client:protos uses a directory for the output. It should be a list of files instead. I think we need some form of code generation here, and this code is pretty messy anyway so it'll be good to clean it up.

blathers-crl[bot] commented 2 weeks ago

Based on the specified backports for linked PR #129677, I applied the following new label(s) to this issue: branch-release-24.1. Please adjust the labels as needed to match the branches actually affected by this issue, including adding any known older branches.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

rickystewart commented 2 weeks ago

Oh, there is still that issue with eslint-plugin-crdb. Re-opening.

rickystewart commented 2 weeks ago

Here is what I've found: running dev gen js by itself still fails:

cockroach$ ./dev gen js --debug
$ bazel build //pkg/ui/workspaces/eslint-plugin-crdb:eslint-plugin-crdb-lib //pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client //pkg/ui/workspaces/cluster-ui:ts_project
...
ERROR: Rel: can't make  relative to /private/var/tmp/_bazel_ricky/be70b24e7357091e16c49d70921b7985/execroot/com_github_cockroachdb_cockroach/bazel-out/darwin_arm64-fastbuild/bin/pkg/ui/workspaces/eslint-plugin-crdb/dist

This error is associated with that directory (.../eslint-plugin-crdb/dist) being empty.

You can fix this by running bazel build pkg/ui/workspaces/eslint-plugin-crdb:ts_project. When you do this, then the next dev gen js --debug will succeed.