diff --git a/About-GitLab-CI,-forks-and-merge-requests.md b/About-GitLab-CI,-forks-and-merge-requests.md new file mode 100644 index 0000000..7b7d115 --- /dev/null +++ b/About-GitLab-CI,-forks-and-merge-requests.md @@ -0,0 +1,38 @@ +# GitLab CI, forks and merge requests + +When a user forks our repository and adds commits to it, the CI pipeline is run in that user's space. This implies that if the user is newly created in GitLab and has not validated his or her account using a credit card, the CI pipeline will not run as the runners are disabled. + +![shared runners disabled](uploads/8917a0e07bb405da8c0279db210439d5/image.png) + +This limitation is [GitLab's way of fighting cryptocurrency mining abuse][abuse]. + +[abuse]: https://about.gitlab.com/blog/2021/05/17/prevent-crypto-mining-abuse/ + +## Implications + +If a user is in the situation described above, when he or she sends us a merge request, the pipeline will not be run because, as mentioned above, the user's runners will be disabled. + +## Solution + +Even if the user is not validated, we can manually run the pipeline on the content of the merge request in our user space. We simply do the following: + +1. Revise the code. +2. Make sure that code has been revised. +3. Have you revised the merge request code? Do it again. +4. Open the merge request. +5. Go to _Pipelines_ tab. +6. Press button _Run pipeline_. + +Again, make sure you have revised the code before run the pipeline as it will run in our user space and with our privileges. + +## To be considered + +If the forked project sends the merge request using its own develop branch then when we press _Run pipeline_ button the system will try to run the stages `Translations` and `APK`. This is because the branch is `develop` and, as the execution has been approved by us, it's using our project ID. There is nothing we can do against this, because if we prohibit these stages in a merge request then it will not work with our merge requests either. + +However, there is a way to prevent these stages from running. Simply once we have approved the run of the pipeline, we can click on the _forbidden icon_ so that the last two stages are not executed: + +![cancel stage](uploads/46d311361f7087c096f24f94b378fa92/image.png) + +![pipeline with stages cancelled](uploads/a6ba25dc81f21add27bbef2354054fcb/image.png) + +This will not happen if the merge request comes from any branch other than `develop`. \ No newline at end of file