Code Monkey home page Code Monkey logo

gitlabgroupexporter's Introduction

(BETA) GitlabGroupExporter

Export group with all projects and subgroups

Requirements

  • python >=3.6
  • admin rights over gitlab (owner role to export groups and projects, admin rights to create groups, projects...)
  • API token on both Gitlab (asigned to your gitlab user)

Install

  1. Install requirements
pip3 install -r requirements.txt

Usage

Configuration file (config.yml)

Set your configuration with config.yml (on root path)

vim config.yml
OLD_GITLAB_URL: https://oldgitlab.com
OLD_TOKEN: XXXX
NEW_GITLAB_URL: http://newgitlab.com
NEW_TOKEN: XXXXX
OLD_GROUP_ID: XXXXX
NEW_GROUP_NAME: MyNewImportedGroup

Variables description

  • OLD_GITLAB_URL: Gitlab url from you want to export the group
  • OLD_TOKEN: Gitlab token with API access from old gitlab instance
  • NEW_GITLAB_URL: Gitlab url where you want to import that new group
  • NEW_TOKEN: Gitlab token with API access from new gitlab instance
  • OLD_GROUP_ID: Group Id from the group that you want to export (on old gitlab instance)
  • NEW_GROUP_NAME: New group name that you will create (import) over that new gitlab instance

Example command

mkdir /tmp/gitlab 
python3 main.py -p /tmp/gitlab/ -l INFO

Note: Directory must be created and need to be empty. When you set the directory on the command, need to end with slash '/'

Examples

Group to be exported

Old group

New group imported from old gitlab instance

New group

Command

Command example

Config  

Config example

Result

Result

Then, delete the directory if you no longer need it.

rmdir /tmp/gitlab

About code

  • This code written in python possibly has many unanticipated improvements. It is not a program designed at a productive level contemplating all the possible errors that may exist.

  • It is only a functional program designed to automate.

  • As for the python code itself, possible improvements are welcome. I am not a 100% experienced python programmer, but I am having fun. Enjoy :)

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.