Skip to content

Add Gerrit forge adapter#119

Open
abhinavgautam01 wants to merge 2 commits into
git-pkgs:mainfrom
abhinavgautam01:feat/gerrit-adapter
Open

Add Gerrit forge adapter#119
abhinavgautam01 wants to merge 2 commits into
git-pkgs:mainfrom
abhinavgautam01:feat/gerrit-adapter

Conversation

@abhinavgautam01

Copy link
Copy Markdown

Summary

Adds initial Gerrit support as a forge adapter.

This maps Gerrit projects, branches, tags, files, and changes into the existing forge interfaces where they fit cleanly. Unsupported Gerrit concepts explicitly return ErrNotSupported.

Closes #12.

What works

  • Adds gerrit forge type and detection via /config/server/version
  • Adds Gerrit REST client with XSSI prefix stripping
  • Supports repositories/projects
  • Supports branch list/create/delete
  • Supports tag listing
  • Supports file content retrieval
  • Maps Gerrit changes to pull requests for get/list/diff/comment/submit/abandon/restore
  • Supports reviewer request/removal and review submission
  • Adds explicit unsupported-service stubs for issues, labels, milestones, releases, CI, secrets, deploy keys, notifications, collaborators and commit statuses
  • Updates CLI help, config docs, README and token lookup

Tests

  • go test ./...
  • git diff --check

@mestadler

Copy link
Copy Markdown

+1 on this feature, fills the single gap that I have for the cli tool, will run a qa on it against my gerrit and provide feedback.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, the adapter is well structured and follows the existing gitea/gitlab shape closely. Tests pass locally and pr checkout will work for Gerrit changes for free since #117 already handles refs/-prefixed head refs.

A few things to address before merging, see inline. The main ones are the Code-Review label type, the hardcoded abandon/restore messages, and the gerrit-review.googlesource.com default which doesn't actually work with the auth scheme implemented here.

Comment thread gerrit/reviews.go Outdated
Comment thread gerrit/changes.go Outdated
Comment thread gerrit/changes.go Outdated
Comment thread gerrit/repos.go
Comment thread internal/resolve/resolve.go Outdated
Comment thread gerrit/repos.go
Comment thread gerrit/gerrit.go Outdated
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.

Gerrit adapter

3 participants