Skip to content

Create Packages::Rubygems::Package class for rubygems packages

Context

Step by step we want to complete the refactoring and extract every package format from Packages::Package to its own class.

What does this MR do and why?

This MR introduces Packages::Rubygems::Package class for rubygems packages.

Rubygems Package Registry is in alpha https://docs.gitlab.com/ee/user/packages/rubygems_registry/

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

No.

How to set up and validate locally

Since the rubygems package registry is under development docs,
only publishing gem is available. Let's verify the changes proposed in this MR with it:

  1. Enable the feature flag Feature.enable(:rubygem_packages)

  2. Create a new project.

  3. In the new project add .gitlab-ci.yml file with the following content:

    image: ruby
    
    run:
      before_script:
        - mkdir ~/.gem
        - echo "---" > ~/.gem/credentials
        - |
          echo "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
        - chmod 0600 ~/.gem/credentials # rubygems requires 0600 permissions on the credentials file
    script:
      - mkdir my_gem && cd
      - |
        tee -a my_gem.gemspec << END
        Gem::Specification.new do |s|
          s.name        = 'my_gem'
          s.version     = '0.0.1'
          s.summary     = "This is an example!"
          s.authors     = ["Ruby Coder"]
          s.add_development_dependency "pry"
        end
        END
      - gem build my_gem.gemspec
      - gem push my_gem-0.0.1.gem --host ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/rubygems
  4. Go to http://gdk.test:3000/<project path>/-/packages and check that the new gem my_gem was published.

Related to #435832 (closed)

Edited by Dzmitry Meshcharakou

Merge request reports