Skip to content

Allow exceptions to "Allow duplicates" group setting for Terraform modules

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

UI Changes

Current: We disable the Exceptions input box in the UI if Allow duplicates is toggled on.

New behavior: (only for Terraform modules) Always keep the Exceptions input box enabled

Logic Changes

Current: If Allow duplicates is off, duplicates are not allowed except if the package name or version matches the Exceptions regexp.

New behavior: Current + If Allow duplicates is on, duplicates are allowed except if the package name or version matches the Exceptions regexp.

Implementation

To implement this, we'll need three checks:

  • 1️⃣ Does the group settings allow duplicates for Terraform modules?
  • 2️⃣ Is the package a duplicate of an existing package?
  • 3️⃣ Does the package name or version match the exception regex?

To make the changes smaller and easier to review, let's split the changes into two MRs:

  1. Refactor ::Namespace::PackageSetting.duplicates_allowed?(package) into two methods that do checks 1️⃣ and 3️⃣ above. That way our checks can be easily modified and reused to implement the new behavior.
  2. Implement the new behavior: If Allow duplicates is on, duplicates are allowed except if the package name or version matches the Exceptions regexp.
Edited by 🤖 GitLab Bot 🤖