Open walkerburgin opened 1 week ago
Thanks for such a detailed bug report, and for bisecting!
I'm not sure why local vs CI would be different. All I can think of is one (local vs CI) has a) the go_deps
stuff cached and it is not being invalided properly, or b) is reading the config for those go_deps
differently.
A few questions:
bazel configure
extremely slow like https://github.com/aspect-build/aspect-cli/issues/760 (badly) describes?clean --expunge
does anything change? Local or CI?Does adding these directives change anything?
# gazelle:go_naming_convention import
# gazelle:go_naming_convention_external import
It's possible only the _external
one is needed. This is mainly just for being explicit to make sure bazel configure
and go_deps
are using the same config for external deps - so import_alias
or go_default_library
might also work if we just need to be explicit.
Yeah, running bazel configure
is noticeably faster after the upgrade to 2024.45.21
.
Running clean --expunge
locally reproduces the behavior I was seeing on CI (back to go_default_library
)
➜ ASPECT_CLI_LOG_DEBUG=trace bazel configure
2024/11/09 18:59:17 Found bazel_gazelle_go_repository_config(s): /private/var/tmp/_bazel_walkerburgin/492fc5f288b88071131e05c5241cd082/external/gazelle~~go_deps~bazel_gazelle_go_repository_config/WORKSPACE
Updating BUILD files for go
37 BUILD files visited
0 BUILD files updated
➜ bazel clean --expunge
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.
➜ ASPECT_CLI_LOG_DEBUG=trace bazel configure
2024/11/09 19:02:12 No bazel_gazelle_go_repository_config found in output_base: /private/var/tmp/_bazel_walkerburgin/492fc5f288b88071131e05c5241cd082
Updating BUILD files for go
37 BUILD files visited
9 BUILD files updated
Adding the directives explicitly got the CI build and the local build to agree 👍
Yeah, running bazel configure is noticeably faster after the upgrade to 2024.45.21.
The way the rules_go gazelle plugin works under bzlmod requires essentially a bazel query to find the magic gazelle~~go_deps~bazel_gazelle_go_repository_config
repository which is essentially just a cached list of all go modules. Putting it in a repo means bazel will fully cache it, remote-cache (and exec?) work with it etc.
But that is the first time any gazelle logic has had to know the location of a repo like that which is why the fix in the aspect-cli was required. I hope to try to improve that more in the future.
Running clean --expunge locally reproduces the behavior I was seeing on CI (back to go_default_library)
Unfortunately I don't understand why 😢
Adding the directives explicitly got the CI build and the local build to agree 👍
Are you unblocked then? I think this is still an issue but unless people are blocked I assume I won't have time to prioritize it...
Yep, I'm unblocked! Thanks for the help.
What happened?
Bumping
aspect-cli
to2024.45.21
and runningbazel configure
locally resulted in diffs that looked like this:Running
bazel configure
on that commit on GitHub actions (ubuntu-latest
) fails and produces the inverse diff, and I haven't been able to figure out why.I bisected the source of the original diff to ad74a54410d2ece088712e9bb47f9a871b939c99.
Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
go
How to reproduce
Any other information?
No response