Skip to content

GitLab Migration - validate input data before starting a migration

From https://gitlab.com/gitlab-org/manage/import/discussions/-/issues/30#note_1183146440

GitLab Migration allows user to enter a list of import entities with source full path as URL, e.g.

      {
        "source_full_path": "http://gitlab.example/gitlab-org/manage/import/gitlab-migration-test",
        "source_type": "group_entity",
        "destination_slug": "gitlab-migration-test",
        "destination_namespace": "import-test"
      }

But we expect each value in a certain format, e.g. source_full_path has to be a relative full path, not a URL.

Proposal

  • Validate each of the fields to return a clear error if user entered something incorrectly.
  • In addition to the source_full_path validation it'd make sense to add a few more:
    • Similarly to source_full_path, destination_namespace should be validated in the same way
    • Should the value of destination_slug be validated in the same way as group/project slug is validated?
    • While we're at it, I wonder if it makes sense to add user permission checks here, too. We do have permission checks later (e.g. in GroupLoader) but that's when migration is already in progress
Edited by Martin Wortschack