Spike: Allow CI/CD mirroring to handle forks on GitHub SCM issue
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/*/head
to 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-1
on a cloned GitLab. - Then, for any
pull_request
and subsequentsynchronize
webhooks received we should save the ref in the formrefs/pull/*/head
inExternalPullRequest
model. - Provide a method
ExternalPullRequest#gitlab_ref
that would translate it torefs/merge-requests/*/head
and used asref
inExternalPullRequest::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/*/head
and 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
Edited by Marius Bobin