opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
212 stars 18 forks source link

task: Require CoreRepository location to be unique #926

Closed ogenstad closed 1 year ago

ogenstad commented 1 year ago

Component

API Server / GraphQL

Task Description

The location attribute on a repository is missing the unique constraint.

        {
            "name": "Repository",
            "namespace": "Core",
            "description": "A Git Repository integrated with Infrahub",
            "label": "Repository",
            "default_filter": "name__value",
            "order_by": ["name__value"],
            "display_labels": ["name__value"],
            "branch": True,
            "inherit_from": ["LineageOwner", "LineageSource"],
            "attributes": [
                {"name": "name", "kind": "Text", "unique": True},
                {"name": "description", "kind": "Text", "optional": True},
                {"name": "location", "kind": "Text"},  <-- no "unique": True
                {"name": "default_branch", "kind": "Text", "default_value": "main"},
                {"name": "commit", "kind": "Text", "optional": True},
                {"name": "username", "kind": "Text", "optional": True},
                {"name": "password", "kind": "Text", "optional": True},
            ],

This is problematic with regards to how the git agent would find the correct credentials for a repository. We should change this to enforce unique locations.

ogenstad commented 1 year ago

Fixed in #932.