How to do code review for google cloud git repo

2020-07-01 06:22发布

问题:

We are hosting git repo on the google cloud platform. I know for github.com, we can use pull requests for code reviews, but google cloud does not seem to provide that.

How do I perform code review for repos on google cloud platform?

回答1:

One possibility (not ideal, I know, but still something) would be to have your cloud repo connected to a GitHub or BitBucket repo which you could use for code reviews instead. From Connecting a Hosted Repository:

You can connect a Cloud Source Repository to a Git repository hosted on GitHub or Bitbucket. When you push changes to the hosted repository, the changes are automatically synchronized with the Cloud Source Repository.



回答2:

You can use a separate code review app that integrates with Git.

One example of this is JetBrains Upsource, which supports adding a generic Git repository. It's free for a few users, but paid after that. If you're already using a JetBrains IDE in general or due to using a GCP plugin, it also has some integrations with their IDE products.

Also see open source options including one mentioned in a comment:

  • Review Board
  • Gerrit


回答3:

Branches.

A code review ability is the ability to view commits and code (and perhaps facilitate discussion) before they're mainlined.

  • Ask your contributors of code to push to review-featureName branches.
  • The reviewers review the branch for quality, and if accepted, they merge it in.
  • If not, they add in commits which explain why it failed review.
  • The contributor reviews these, replies to TODOs/resolves them. And then, depending on conventions, could squash everything together, push to a new review branch, etc.

And the process repeats. You don't have a web interface, but you could easily work with internal project management tools which have access to the commits to reference them and have a conversation.