Skip to content

Automate release and publishing logic for Ruby

Nikola Milojevic requested to merge ci_cd_release_and_publish-ruby-gem into main

This MR introduces the following enhancements and automations for managing the Ruby Gem and deployment pipeline using a Makefile and GitLab CI/CD:

Makefile Enhancements:

  • Package Building:
    • The build target is responsible for building the Ruby Gem, copying assets like config, LICENSE, and CONTRIBUTING.md, and cleaning up post-build.
  • Asset Management:
    • The copy-assets target handles copying configuration files and assets to the package directory.
  • Cleaning:
    • A clean target is provided to clean up the copied assets from the package directory.

CI/CD Pipeline Enhancements:

  • Ruby Release Process:
    • Build and Package:
      • build:ruby:env: Parses the Ruby gem version from lib/gitlab/cloud_connector/version.rb and stores it in the environment.
      • build:ruby:gem: Builds the Ruby Gem using make build. (it copies config/** files, LICENSE and CONTRIBUTING.md file to be included in the package)
    • Smoke Testing:
      • build:ruby:gem:smoke-test: Installs the built Ruby gem and performs a basic import test to ensure that the gem was built correctly.
    • Release Creation:
      • release:ruby:creation: Creates a ruby release in GitLab based on the gathered release notes and commit information (latest Configuration change - latest commit sha and commit date)
    • Publishing to Ruby.org:
      • release:ruby:gem:publication: Publishes the built Ruby gem to RubyGems.org repository.

Pipeline Stages:

  • Test Stage:
    • Linting, formatting, and testing steps are included, ensuring code quality before building the package.
  • Deploy Stage:
    • Builds the Ruby gem, tests it, and prepares for release.
  • Release Stage:
    • Creates a GitLab release and publishes the package to RubyGems.org.

NOTE: The Ruby deploy and release jobs are only triggered if the version has changed in src/ruby/lib/gitlab/cloud_connector/version.rb, and the change is merged to the main` branch.


Edited by Nikola Milojevic

Merge request reports

Loading