Skip to content

Fix duplicate validation errors for Project deploy keys

What does this MR do and why?

Fixes duplicate validation happening for deploy_keys_projects association when a DeployKey is created for a project.

Screenshots or screen recordings

Before: https://gitlab.com/gitlab-org/gitlab/uploads/9823dcdebaddbc1ac12c18d9ed67411d/image.png

After: Screenshot_2023-01-11_at_4.40.18_PM

How to set up and validate locally

  • Set a Maximum allowed lifetime for SSH keys under admin/application_settings/general
  • Try creating a project deploy key following steps from doc
  • Validation error shown in the UI should have repeated messages from the model associations.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #378365 (closed)

Edited by Bala Kumar

Merge request reports