Skip to content

PG::CheckViolation: ERROR: new row for relation "packages_rubygems_metadata" violates check constraint "check_b0f4f8c853"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When pushing a gem to the Gitlab Rubygems registry I get this error :

PG::CheckViolation: ERROR:  new row for relation "packages_rubygems_metadata" violates check constraint "check_b0f4f8c853"

The UI generates the error Invalid Package: failed metadata extraction

image

Steps to reproduce

Create a gem with a spec.files= > 255 characters and push it to the registry.

Example from a real Ruby gem :

  spec.required_ruby_version = ">= 2.5.0"

  spec.files = ["foo.gemspec", "README.md"] + %x(git ls-files | grep -E '^(lib)').split("\n")

  spec.add_runtime_dependency "dotenv"
  spec.add_runtime_dependency "rake"
  spec.add_runtime_dependency "zeitwerk"

I think this comes from here : https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/structure.sql?expanded=true&viewer=simple#L16056 where a DB constraint is put on the files field which can be far greater than 255 characters.

Thank you!

Edited by 🤖 GitLab Bot 🤖