Skip to content

Enhance developing workflow with Ruby gem in Gitlab Rails

Quang-Minh Nguyen requested to merge qmnguyen0711/publish-development-gem into master

Sometimes, we need to work on both Gitaly and GitLab Rails implementations in parallel. Ideally, we can define and publish all Protobuf changes beforehand. In practice, a complicated change might require modifying the Protobuf multiple times until reaching a stable state. It's more convenient to let GitLab Rails point the gem to the the developing branch in Gitaly.

Unfortunately, Gitaly source code doesn't include the gemspec or any autogenerated Ruby codes. All of them are generated on the flight while running make build-proto-gem. Thus, we cannot point the gem to the developing branch directly on CI environment.

This MR tweaks the gem generation script:

  • Use current HEAD hash as the pre-release version.
  • Persist gem working directory after building. This allows local GitLab Rails point to that directory directly.
  • Add support for gem name customization. This allows the developer publish the gem under a different name during development.

Example custom gem registry: https://rubygems.org/gems/gitaly-qmnguyen

  • Verify local gem
bundle info gitaly
  * gitaly (16.7.0.pre.be5e58504)
        Summary: Auto-generated gRPC client for gitaly
        Homepage: https://gitlab.com/gitlab-org/gitaly
        Source Code: https://gitlab.com/gitlab-org/gitaly/-/tree/master/proto
        Bug Tracker: https://gitlab.com/gitlab-org/gitaly/-/issues
        Path: /path/to/gitaly/_build/gitaly-gem
  • Verify custom published gem
❯ bundle info gitaly-qmnguyen
  * gitaly-qmnguyen (16.7.0.pre.19a698e29)
        Summary: Auto-generated gRPC client for gitaly
        Homepage: https://gitlab.com/gitlab-org/gitaly
        Source Code: https://gitlab.com/gitlab-org/gitaly/-/tree/master/proto
        Bug Tracker: https://gitlab.com/gitlab-org/gitaly/-/issues
        Path: /Users/qmnguyen/.rvm/gems/ruby-3.1.4/gems/gitaly-qmnguyen-16.7.0.pre.19a698e29
Edited by Quang-Minh Nguyen

Merge request reports