RubyGems metadata

Merged Steve Abrams requested to merge 299263-rubygems-metadata-migration into master

💎 Context

This MR is part of the implementation effort to support RubyGems with the GitLab package registry. This adds the supporting models and tables that will be used to store RubyGem specific data.

🔍 What does this MR do?

  • Adds Packages::Rubygems::Metadatum model and packages_rubygems_metadata table, which will be used to store gem metadata for gems uploaded to the GitLab package registry.

  • Adds :rubygems as a package type

  • Adds plan limits for the maximum RubyGems package file size (default is 3GB). This limit was determined by looking at what the limit is on the public RubyGems.org registry (500MB based on this thread), and then deciding to bump the limit to match what we do for other package types on GitLab.com.

  • Adds supporting test fixtures and factories

🐘 Database

Up migration
== 20210203221631 CreatePackagesRubygemsMetadata: migrating ===================
-- create_table(:packages_rubygems_metadata, {:id=>false})
-- quote_column_name(:authors)
   -> 0.0000s
-- quote_column_name(:files)
   -> 0.0000s
-- quote_column_name(:summary)
   -> 0.0000s
-- quote_column_name(:description)
   -> 0.0000s
-- quote_column_name(:email)
   -> 0.0000s
-- quote_column_name(:homepage)
   -> 0.0000s
-- quote_column_name(:licenses)
   -> 0.0000s
-- quote_column_name(:metadata)
   -> 0.0000s
-- quote_column_name(:author)
   -> 0.0000s
-- quote_column_name(:bindir)
   -> 0.0000s
-- quote_column_name(:cert_chain)
   -> 0.0000s
-- quote_column_name(:executables)
   -> 0.0000s
-- quote_column_name(:extensions)
   -> 0.0000s
-- quote_column_name(:extra_rdoc_files)
   -> 0.0000s
-- quote_column_name(:platform)
   -> 0.0000s
-- quote_column_name(:post_install_message)
   -> 0.0000s
-- quote_column_name(:rdoc_options)
   -> 0.0000s
-- quote_column_name(:require_paths)
   -> 0.0000s
-- quote_column_name(:required_ruby_version)
   -> 0.0000s
-- quote_column_name(:required_rubygems_version)
   -> 0.0000s
-- quote_column_name(:requrements)
   -> 0.0000s
-- quote_column_name(:rubygems_version)
   -> 0.0000s
-- quote_column_name(:signing_key)
   -> 0.0000s
   -> 0.0213s
-- quote_table_name("check_994b68eb64")
   -> 0.0000s
-- quote_table_name("check_b0f4f8c853")
   -> 0.0000s
-- quote_table_name("check_8be21d92e7")
   -> 0.0000s
-- quote_table_name("check_0154a18c82")
   -> 0.0000s
-- quote_table_name("check_22814c771b")
   -> 0.0000s
-- quote_table_name("check_946cb96acb")
   -> 0.0000s
-- quote_table_name("check_7cb01436df")
   -> 0.0000s
-- quote_table_name("check_ea02f4800f")
   -> 0.0000s
-- quote_table_name("check_b7b296b420")
   -> 0.0000s
-- quote_table_name("check_9824fc9efc")
   -> 0.0000s
-- quote_table_name("check_6ff3abe325")
   -> 0.0000s
-- quote_table_name("check_5988451714")
   -> 0.0000s
-- quote_table_name("check_242293030e")
   -> 0.0000s
-- quote_table_name("check_6ac7043c50")
   -> 0.0000s
-- quote_table_name("check_5f9c84ea17")
   -> 0.0000s
-- quote_table_name("check_3d1b6f3a39")
   -> 0.0000s
-- quote_table_name("check_bf16b21a47")
   -> 0.0000s
-- quote_table_name("check_f76bad1a9a")
   -> 0.0000s
-- quote_table_name("check_ca641a3354")
   -> 0.0000s
-- quote_table_name("check_545f7606f9")
   -> 0.0000s
-- quote_table_name("check_add74953fe")
   -> 0.0000s
-- quote_table_name("check_27619a7922")
   -> 0.0000s
-- quote_table_name("check_9d42fa48ae")
   -> 0.0000s
-- quote_table_name(:packages_rubygems_metadata)
   -> 0.0000s
-- execute("ALTER TABLE \"packages_rubygems_metadata\"\nADD CONSTRAINT \"check_994b68eb64\" CHECK (char_length(\"authors\") <= 255),\nADD CONSTRAINT \"check_b0f4f8c853\" CHECK (char_length(\"files\") <= 255),\nADD CONSTRAINT \"check_8be21d92e7\" CHECK (char_length(\"summary\") <= 1024),\nADD CONSTRAINT \"check_0154a18c82\" CHECK (char_length(\"description\") <= 1024),\nADD CONSTRAINT \"check_22814c771b\" CHECK (char_length(\"email\") <= 255),\nADD CONSTRAINT \"check_946cb96acb\" CHECK (char_length(\"homepage\") <= 255),\nADD CONSTRAINT \"check_7cb01436df\" CHECK (char_length(\"licenses\") <= 255),\nADD CONSTRAINT \"check_ea02f4800f\" CHECK (char_length(\"metadata\") <= 255),\nADD CONSTRAINT \"check_b7b296b420\" CHECK (char_length(\"author\") <= 255),\nADD CONSTRAINT \"check_9824fc9efc\" CHECK (char_length(\"bindir\") <= 255),\nADD CONSTRAINT \"check_6ff3abe325\" CHECK (char_length(\"cert_chain\") <= 255),\nADD CONSTRAINT \"check_5988451714\" CHECK (char_length(\"executables\") <= 255),\nADD CONSTRAINT \"check_242293030e\" CHECK (char_length(\"extensions\") <= 255),\nADD CONSTRAINT \"check_6ac7043c50\" CHECK (char_length(\"extra_rdoc_files\") <= 255),\nADD CONSTRAINT \"check_5f9c84ea17\" CHECK (char_length(\"platform\") <= 255),\nADD CONSTRAINT \"check_3d1b6f3a39\" CHECK (char_length(\"post_install_message\") <= 255),\nADD CONSTRAINT \"check_bf16b21a47\" CHECK (char_length(\"rdoc_options\") <= 255),\nADD CONSTRAINT \"check_f76bad1a9a\" CHECK (char_length(\"require_paths\") <= 255),\nADD CONSTRAINT \"check_ca641a3354\" CHECK (char_length(\"required_ruby_version\") <= 255),\nADD CONSTRAINT \"check_545f7606f9\" CHECK (char_length(\"required_rubygems_version\") <= 255),\nADD CONSTRAINT \"check_add74953fe\" CHECK (char_length(\"requrements\") <= 255),\nADD CONSTRAINT \"check_27619a7922\" CHECK (char_length(\"rubygems_version\") <= 255),\nADD CONSTRAINT \"check_9d42fa48ae\" CHECK (char_length(\"signing_key\") <= 255)\n")
   -> 0.0052s
== 20210203221631 CreatePackagesRubygemsMetadata: migrated (0.0360s) ==========
Down migration
== 20210203221631 CreatePackagesRubygemsMetadata: reverting ===================
-- drop_table(:packages_rubygems_metadata)
   -> 0.0134s
== 20210203221631 CreatePackagesRubygemsMetadata: reverted (0.0134s) ==========

Screenshots (strongly suggested)

Not Applicable

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #299263 (closed)

Edited by Steve Abrams