Search code examples
githubcontinuous-integrationgithub-actionsgitlab-cimesos

Configuring a self hosted GitLab-CE CI/CD server in parallel with a GitHub Team account


I am looking to perform code reviews as part of a trunk based development approach with my backend team on a self hosted gitlab server. I also wish to use it to deploy to internally hosted infrastructure. I also want to maintain my current Github team account from which I will be looking to make deployments to AWS and have it server as a backup of the main branch.

My approach to setting this up will be as follows:

  • Create a new GitLab repository and initialize it with a README file.

  • Set up a branch protection rule for my main branch (either called "main" or "master") to prevent direct pushes to it. I'll need to set up a rule to require code review and at least one approval from a team member before any changes can be merged.

  • Create feature branches for new changes or bug fixes. These branches should be short-lived and should only contain the changes required for the specific task.

  • Use merge requests (MRs) to merge changes from feature branches into the main branch. Each MR should have a description explaining the changes, and it should only include the changes required for the specific feature or bug fix.

  • Use GitLab's code review features, such as inline comments and code snippets, to review and discuss changes with team members before merging them into the main branch.

  • Set up automated testing and continuous integration (CI) using GitLab CI/CD to ensure that any changes merged into the main branch are automatically built, tested, and deploys an Apache Mesos cluster on my internal hardware.

In parallel to this last step I wish to mirror merges to my main branch to github but to selectively choose when I run Github Actions to deploy to an M3s / Apache mesos cluster to AWS.

Is this possible and does it abide by a sound trunk based development and CI/ CD methodology ?


Solution

  • Sounds ok, though have some thoughts:

    • CI you mentioned will also be running before merge, right? Hard to tell from the way you have formatted this.
    • Why complicate this setup with both GitHub and GitLab?
      • both of them have very similar features. Especially GH can use self-hosted runners to deploy on-prem, and I'm guessing GL can deploy to AWS as well.
    • don't mirror just the merges, mirror the whole main branch. Otherwise you can run into some weird issues down the path.