Spike: Allow CI/CD mirroring to handle forks on GitHub SCM issue
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Based on the following comment #5667 (comment 441462875) we would like to set a spike issue to conduct a short POC and clear some uncertainties:
If refs/pull/*/head are fetched as refs/merge-requests/*/head with project.repository.commits('refs/merge-requests/_id/head', limit: 1), we need to ensure that:
- updating the mirror would push any
refs/pull/*/headto the remote asrefs/merge-requests/*/head - We should be able to verify that the above worked as expected by fetching the ref:
git fetch origin merge-requests/1/head:mr-1 && git checkout mr-1on a cloned GitLab. - Then, for any
pull_requestand subsequentsynchronizewebhooks received we should save the ref in the formrefs/pull/*/headinExternalPullRequestmodel. - Provide a method
ExternalPullRequest#gitlab_refthat would translate it torefs/merge-requests/*/headand used asrefinExternalPullRequest::CreatePipelineService. This means that the new pipeline would have ref asrefs/merge-requests/*/head - Runners should be able to fetch the ref
refs/merge-requests/*/headand do the work
We could potentially make also the same-repo pull requests (supported today) to use the res/merge-requests/*/head instead of the current source_ref. So, we have the same strategy for both same-repo and fork PRs.
Expected outcome
Since the purpose of this issue is to allocate some engineering time to break this issue properly so we’ll come better prepared for the next iteration the expected outcome is:
- List of broken issues of how we can iterate through this existing issue