Follow-up from "Add developer documentation for Pull mirroring process"
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !172707 should be addressed:
-
@jwoodwardgl started a discussion: (+1 comment)
We have added the main flow for pull mirroring. In a follow-up we should add the tangential details so it's easy to see exactly what happens. I think it's a good idea to keep these separate from the main flow, maybe something like
## Stage 2: `ProjectImportScheduleWorker` - Pre-verification
The [`ProjectImportScheduleWorker`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/workers/project_import_schedule_worker.rb) performs several checks before scheduling the pull mirroring process:
- Verifies if the project still exists.
- Changes the project’s import status to `scheduled`.
- Marks the project as `failed` if it is no longer eligible for pull mirroring.
The `project.import_state.schedule` call triggers a series of actions, ultimately scheduling the [`RepositoryUpdateMirrorWorker`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/workers/repository_update_mirror_worker.rb):
1. [`import_state.schedule`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/workers/project_import_schedule_worker.rb#L29)
1. [`ProjectImportState#after_transition`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/app/models/project_import_state.rb#L49-58)
1. [`EE::Project#add_import_job`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/models/ee/project.rb#L778)
1. [`RepositoryUpdateMirrorWorker`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/workers/repository_update_mirror_worker.rb#L3)
### Additional details
1. [`Gitlab::Metrics#add_event(:mirrors_scheduled)`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/ee/app/models/ee/project.rb#L795)
1. [`Project#log_import_activity`](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/app/models/project.rb#L1491-1500)
1. [`ProjectImportState#update` job ID and correlation ID](https://gitlab.com/gitlab-org/gitlab/-/blob/f77763345e35c7c4c6a4320f1bd1633a392e3e7c/app/models/project_import_state.rb#L55)
Edited by 🤖 GitLab Bot 🤖