Add request_channel to file-based and Git-URL importers

What

Follow-up to #627877 (closed). That task wires request_channel (API/UI/Congregate) through:

  • Direct Transfer / Offline Transfer (BulkImport + BulkImports::Entity), via Import::BulkImports::EphemeralData.
  • Standard project importers that inherit Import::BaseService: GitHub, Bitbucket, Bitbucket Server, Gitea, Fogbugz.

What this task covers

The remaining standard importers that do not inherit Import::BaseService and so are not picked up by that MR:

  • File-based project import (gitlab_project) — Projects::GitlabProjectsImportService, app/controllers/import/gitlab_projects_controller.rb, lib/api/project_import.rb
  • Manifest import — Import::Manifest::ProjectCreator, app/controllers/import/manifest_controller.rb
  • Git repository by URL — app/controllers/import/url_controller.rb
  • File-based group import (gitlab_group_export) — Groups::ImportExport::ImportService, app/controllers/groups/import_export_controller.rb, lib/api/group_import.rb

The plumbing is already in place from #627877 (closed):

  • ProjectImportState#request_channel= / #request_channel (Redis-backed via Gitlab::Cache::Import::Caching)
  • GroupImportState#request_channel= / #request_channel (same)
  • ProjectImportState#track_project_import_event and GroupImportState#track_group_import_event already read request_channel and include it in additional_properties.compact
  • Event YAMLs already declare request_channel
  • Gitlab::Import::RequestChannel.detect(request) helper (returns :api / :congregate; controllers pass :ui explicitly)

What each importer needs

For each entry point:

  1. Detect the channel at the boundary (controller passes :ui; API endpoint calls Gitlab::Import::RequestChannel.detect(request)).
  2. Thread the channel into the create service.
  3. Set project.import_state.request_channel = channel (or group.import_state.request_channel = channel) after the record is created and before the import worker enqueues.

References