GithubHelp home page GithubHelp logo

lcpo / github-gitlab-sync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ignoredambience/github-gitlab-sync

0.0 0.0 0.0 15 KB

Continuous repository synchroniser between GitHub and GitLab

Ruby 92.48% Shell 7.52%

github-gitlab-sync's Introduction

General Setup

  • Get GitLab admin user details
  • Get GitLab sync user details
  • Get GitHub admin user details

GitHub (<)-> GitLab Sync Setup

  1. Select source GitHub repo
  2. Either: Select/create destination GitLab repo
  3. Generate a ssh keypair.
  4. Install public key to GitHub repo as Deployment Key (with write permissions for reverse sync)
  5. Install public key to GitLab sync user.
  6. Grant GitLab sync user Developer permissions to 2.
  7. Clone 1. add remote 2.
  8. Check branches on 1,2 are consistent/fast-forwardable (or 2 is empty), and sync
  9. Check out synced master.
  10. Update .gitlab-ci.yml with git sync CI task
  11. Commit and push all repo branches to both.
  12. Enable builds on 2. select a builder.
  13. Install private key to secret build variable on 2.
  14. Create a trigger on 2.
  15. Install webhook for trigger on 1. (with GitHub trigger source variable)

Intended Flows

GitHub -> GitLab

  1. Push to GitHub
  2. GitHub webhook calls out to GitLab build trigger
  3. GitLab spawns build tasks including/not-excluding the "triggers" pattern.
  4. Git sync task executes (in GitHub mode).
  5. GitLab version of repository at some unspecified revision/branch is checked out automatically.
  6. Spawn ssh-agent with the stored private key.
  7. Add GitHub remote and fetch.
  8. Fast-forward each GitHub branch into the corresponding GitLab branch, creating if required.
  9. If any changes made, push to GitLab. (This build task ends).
  10. GitLab receives push and starts standard build process.
  11. GitLab executes GitLab->GitHub sync task as part of the standard build, it should be idempotent.

GitLab -> GitHub

  1. Push to GitLab
  2. GitLab spawns build tasks.
  3. Git sync task executes (in GitLab mode).
  4. GitLab version of repository at some current revision/branch is checked out automatically.
  5. Spawn ssh-agent with the stored private key.
  6. Add GitHub remote and fetch.
  7. Fast-forward each GitLab branch into the corresponding GitHub branch, creating if required.
  8. If any changes made, push to GitHub. (This build task ends).
  9. GitHub receives push, triggers GitLab webhook, the resulting push should be idempotent.

Limitations

  • Force pushes on any repo will break the sync, good motivation to forbid them.
  • All normal build tasks will need to be marked as excluding triggers, ones that need to be triggered need special handling, with build variables to select correct mode.
  • git-sync-remote should be pre-installed on the build machine at the moment

Notes

github-gitlab-sync's People

Contributors

ignoredambience avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.