0

In my code hosted on GitHub, we perform some tests and quite a bit of post-processing using GitHub Actions. Now, we would like to (or, actually, have to) use Gitlab runners hosted by a supercomputing center to do some further testing and benchmarking. This cannot be done with self-hosted GitHub runners, because I cannot influence their decision. We do not want to move the whole workflow and community over to some Gitlab instance either. So here's my (general) question: Is there a way to use Gitlab runners from within GitHub Actions?

What I have tried and what kind of works is to mirror the repository over to the Gitlab instance and let the runners do their magic there. Using this neat approach, the GitHub Action will wait for the results of the runners and integrate them into its own results. However, this does not work if contributors fork the repository and make pull requests.

In principle, it looks like this could be doable if the contributors also have accounts and corresponding permissions at the Gitlab instance. This is fine for now, because the community is small and the Gitlab instance is accessible to external contributors. Note that manual action from the maintainers of the code (i.e., me) is required before contributors can execute code with the runners for the first time, so we should be fine concerning security.

However, I cannot get this to work for pull requests, because I fail to mirror them. As said, direct pushes are fine, but nothing else works. This leads me to the more specific questions: How can I mirror a pull request from GitHub to a Gitlab repository? How can I enable this for both pull request and pushes (and do I need even more cases)?

Any help is appreciated! I'm really no expert on GitHub Actions, Gitlab runners or even git itself (beyond the basics). If there's a better way to achieve this, I'm happy to hear about it!

1 Answers1

0

I can think of several workarounds:

1. Change what triggers your pipelines

Since you cannot mirror pull requests, but you can mirror branches, adapt the pipeline triggers in Gitlab so the pipelines are launched whenever there is a new commit, instead of a new PR.

You can always use a staging branch if you want to limit the pipeline executions.

2. Use webhooks

If the Gitlab instance is available on the internet, create a GitHub action that triggers a Gitlab pipeline execution whenever there is a PR on Github, or even open a PR directly in Gitlab. It is well documented:

HiroCereal
  • 550
  • 1
  • 11
  • Thanks for your help. It looks like now my lack of knowledge is in the way: How do I make a commit in Gitlab out of a PR in Github (for 1.)? In 2., you are suggesting to make a PR in Gitlab out of a PR in Github, correct? This sounds like the cleanest solution, but is there a guide how to do this? – Robert Speck Oct 06 '22 at 05:54
  • In Gitlab, "Pull requests" are called "Merge requests". Check this [link](https://stackoverflow.com/questions/37410262/how-to-create-a-gitlab-merge-request-via-command-line). You would need to run what is suggested there in your Github actions – HiroCereal Oct 06 '22 at 07:30