« Blog Home

Is it possible to use GitLab CI/CD with GitHub?

Recently we witnessed a growing interest in GitLab and especially in its advanced built-in CI/CD component. To answer that interest, we have written a few papers on that topic and held several meetings (all of them recorded). As a result, we were asked several questions about GitLab CI/CD.

In this paper I want to address one of those questions, whether it is possible to integrate GitHub with GitLab CI/CD. In other words, is it possible to keep your code in GitHub and use CI/CD of GitLab? Actually, this question is often extended to whether it is possible to connect GitHub + Jira + GitLab CI/CD, because many GitHub users use Jira as well.

The answer is a resolute Yes.

github gitlab logo

We have studied that issue and will show the way to do it.

We realized that whenever the question about GitHub integration with GitLab CI/CD is asked, often the situation is as follows:

The company already uses GitHub in combination with Jenkins and wants to replace Jenkins with a more modern tool. On the other hand, they don’t want to part with GitHub, because they have already invested in adapting GitHub to their needs (in spite of GitLab being an excellent replacement for GitHub too; in the past we have written several papers about it and also recorded a case study of a company, which did such a switch – see the link below).

A GitHub to GitLab CI/CD connection is possible both for the public cloud version of GitHub (github.com) and for the self-hosted one. By “self-hosted” we mean a situation when GitHub is installed on a company’s own server, whether the latter is on-premises or is a private server on a cloud. Actually, the connection is possible for any combination of GitLab CI/CD and GitHub.

The connection is made possible by the following GitLab features:

  • GitLab CI/CD for external repositories (added in March 2018)
  • Remote repository pull mirroring (exists since 2017)

Based on our experience, we recommend building a plan on how you are going to use those features. In particular your development procedures, use of CI/CD, user training etc. The second feature, pull mirroring, also requires thorough planning.

How will it all work together?

The following diagram shows the process we have built and often present to companies, which we advise on development and CI/CD processes.

Note this process is very basic and is supposed to be modified according to projects’ specific needs, but it already shows all “classic quartet” (see the link below) steps.

github gitlab jira flow

Here is an explanation of this diagram:

  1. The group leader creates an issue in JIRA to fix a bug or develop a feature and assigns it to a developer. The issue is in the “To Do” status.
  2. The developer starts working. He moves the issue to status “Doing”, then creates a branch and clones or pulls the repo to his workstation.
  3. After the feature is developed/the bug is fixed, the developer pushes his work to the GitHub server, which triggers a CI pipeline.
  4. If the pipeline succeeds, the developer creates a Pull Request, thus starting a code review.
  5. As a result of the code review, the developer may be requested to do a number of changes before the Pull Request is merged,  with each change triggering a CI pipeline.
  6. At last, the Pull Request is merged into the master branch, and again a CI pipeline runs to check the merge result.
  7. Some changes may be needed on the master branch, after which the software is marked as a new baseline and the JIRA issue is marked as “Done”
  8. Note that there can be many variations on this flow. E.g., there can be an additional JIRA status, “QA Testing” to which the issue moves when a Pull Request is merged.

Summing up (and adding some points we have learned in our tests):

  • It is possible to integrate GitHub with GitLab CI/CD (thus taking advantage of all GitLab CI/CD features).
  • Yes you can integrate Jira + GitHub + GitLab CI/CD.
  • It is possible to integrate Jira with GitLab (in the past we had written a paper on that topic and published a video demonstrating that integration).
  • Alternatively, you can use GitLab as an all-in-one tool, which replaces Jira + GitHub + Jenkins.
  • Similarly, it is possible to integrate GitLab CI/CD with any git server (e.g., Bitbucket, gitolite, gerrit, etc.)
  • Does it pay off to stay with GitHub? Not sure. It depends on a number of factors (you can consult with us).

ALM-Toolbox offers ALM and DevOps solutions including git, GitLab, GitHub, Bitbucket, Jira, Jenkins and Kubernetes. We help customers build end-to-end solutions including dev, test and prod environments; moving to containers and to the cloud.
We provide consulting, licenses, private hosting in the cloud, training, add-on development and we support and sell variety of DevOps and ALM tools.
Questions? Contact us: gitlab@almtoolbox.com or +972-722-240-5222 / 1-866-503-147

Related Links: