[go: up one dir, main page]

Skip to content

Move license detection into GitLab Rails

License detection is currently handled by Gitaly via the RepositoryService.FindLicense RPC call. Implementation wise, detection of licenses on Gitaly side is handled by the licensee Gem. But as Gitaly is currently in the process of porting over Ruby RPCs to Go, this is one of the places where a port is hard to achieve without user disruption as there is no direct equivalent of licensee for Go. While there is go-licenses which has roughly the same scope, there's several reasons why it is not an ideal fit:

  • It is not going to be a drop-in replacement. Detection of some licenses would break, while others might work.
  • There's a gap between how licenses are reported, and we currently rely on the fact that we use licensee on both GitLab Rails application and in Gitaly. Most importantly, we pass over the short ID of the license from Gitaly to Rails and then have Rails load it via this identifier. go-licenses uses different IDs, and as a result we'd have to maintain a mapping between both implementations.
  • go-licenses pulls in go-git, which would then be another implementation of Git in Gitaly. We want to avoid this.

My proposal is thus to move license detection into the Rails application completely. Instead of using the FindLicense RPC, the Rails app would then use licensee directly by loading respective license blobs via Gitaly's repository RPCs.