Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sluongng/upgrade googleapis #3462

Closed
wants to merge 2 commits into from
Closed

Conversation

sluongng
Copy link
Contributor

GoogleAPIs has been notiriously difficult to upgrade.
The reason being rules_go manage it's own version of GoogleAPIs package and Gazelle is
configured to map all GoogleAPI compilation to the version pinned under rules_go.

This means that unless rules_go were to upgrade their GoogleAPIs version, everybody else
is stuck at the same version as theirs.

We resolve this by doing a couple things:

  1. Override rules_go's go_googleapis archive with our own version. Generating from
    a relatively new commit.

  2. Upgrade our go.mod and go.sum to latest commit by using go get -u <pkg_name>@main
    where main is the default branch of the package's repository.

  3. Override Gazelle resolve directives to use the go_repository version during compilation where possible.

  4. Switch dependencies to //proto to consistently link all of our Go binary using the right version.

At the end, we manage to build our repository using a newer, self-managed version of go_googleapis.

To demonstrate, remove the restriction from building tools/edit_instance_template
that was put there earlier due to difficulties in upgrading go_googleapis.

I expect this to help unblocking us from using latest dependencies and features in the go ecosystem.


Version bump: TODO

Now that we have upgraded the monorepo, we could build
edit_instance_template.
@sluongng
Copy link
Contributor Author

Should help unblock #3462 and #3458. But overall low priority.

@tylerwilliams
Copy link
Member

lol this is amazing, but also pretty hairy. could we get rules_go to update their version of google APIs?

@sluongng
Copy link
Contributor Author

could we get rules_go to update their version of google APIs?

They tried it, and it broke the latest release so there was a revert and patch release after bazelbuild/rules_go#3432

@sluongng
Copy link
Contributor Author

I could instead look into bazelbuild/rules_go#1986 where the plan is to replace go_googleapis with com_google_googleapis.

But will tackle that slowly as it's probably gonna require some change coordination between gazelle and rules_go. 🤔

@sluongng
Copy link
Contributor Author

let's close this as we wait for a proper fix in rules_go / gazelle.

See https://bazelbuild.slack.com/archives/CDBP88Z0D/p1677518730474199 and https://github.com/wyattanderson/googleapis-reproducer for more information.

@sluongng sluongng closed this Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants