Skip to content

feat: API endpoint import/gitea

What does this MR do and why?

API endpoint import/gitea implementation

Allow mass import fro Gitea through scripted import

The endpoint is symetrical to import/github with following parameters

      requires :personal_access_token, type: String, desc: 'Gitea personal access token'
      requires :repo_id, type: Integer, desc: 'Gitea repository ID'
      optional :new_name, type: String, desc: 'New repo name'
      requires :target_namespace, type: String, allow_blank: false, desc: 'Namespace or group to import repository into'
      optional :gitea_host_url, type: String, desc: 'Gitea Host url'
      optional :optional_stages, type: Hash, desc: 'Optional stages of import to be performed'
      optional :timeout_strategy, type: String, values: ::ProjectImportData::TIMEOUT_STRATEGIES, desc: 'Strategy for behavior on timeouts'

How to set up and validate locally

curl --request POST \
  --url "https://gitlab.example.com/api/v4/import/gitea" \
  --header "content-type: application/json" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --data '{
    "personal_access_token": "aBc123abC12aBc123abC12abC123+_A/c123",
    "repo_id": "12345",
    "target_namespace": "group/subgroup",
    "new_name": "NEW-NAME",
    "gitea_host_url": "https://gitea.example.com",
    "optional_stages": {
      "single_endpoint_issue_events_import": true,
      "single_endpoint_notes_import": true,
      "attachments_import": true,
      "collaborators_import": true
    },
}'

relates to #442717

Edited by Carla Drago

Merge request reports