Giter VIP home page Giter VIP logo

gitlab-copy's Introduction

GitLab Copy

Build Status

gitlab-copy is a simple tool for copying issues/labels/milestones/notes from one GitLab project to another, possibly running on different GitLab instances.

By default, gitlab-copy won't copy anything until told explicitly to do so on the command line: running it will do nothing but showing some statistics.

Note: GitLab 8.6 introduced the ability to move an issue to another project, but on the same GitLab installation only. gitlab-copy can still prove valuable to move issues between projects on different GitLab hosts and to perform batch operations from the command line (see the feature list below).

Download

Installing gitlab-copy is very easy since it comes as a static binary with no dependencies. Just grab a compiled version for your system (or have a look at the Compile From Source section).

Features

The following features are available:

  • Copy milestones if not existing on target (use milestonesOnly to copy milestones only, see below)
  • Copy all source labels on target (use labelsOnly to copy labels only, see below)
  • Copy issues if not existing on target (by title)
  • Apply closed status on issues, if any
  • Set issue's assignee (if user exists) and milestone, if any
  • Copy notes (attached to issues), preserving user ownership
  • Can specify in the config file a specific issue or range of issues to copy
  • Auto-close source issues after copy
  • Add a note with a link to the new issue created in the target project
  • Use a custom link text template, like "Closed in favor or me/myotherproject#12"

Usage

First, make sure you have valid GitLab account tokens for both source and destination GitLab installations. They are used to access GitLab resources without authentication. GitLab private tokens are availble in "Profile Settings -> Account".

Now, write a gitlab.yml YAML config file to specify source and target projects, along with your GitLab account tokens:

from:
  url: https://gitlab.mydomain.com
  token: atoken
  project: namespace/project
to:
  url: https://gitlab.myotherdomain.com
  token: anothertoken
  project: namespace/project

Note that a specific issue or ranges of issues can be specified in the YAML config file. If you want to copy only issue #15 and issues #20 to #30, add an issues key in the from: key:

from:
  url: https://gitlab.mydomain.com
  token: atoken
  project: namespace/project
  issues:
  - 15
  - 20-30
...

In order to copy all labels from one project to another (labels only, not issues), just append a labelsOnly entry in the from section:

from:
  url: https://gitlab.mydomain.com
  token: atoken
  project: namespace/project
  labelsOnly: true
to:
  url: https://gitlab.sameorotherdomain.com
  token: anothertoken
  project: namespace/otherproject
...

In order to copy all milestones only, just add a milestonesOnly entry in the from section:

from:
  url: https://gitlab.mydomain.com
  token: atoken
  project: namespace/project
  milestonesOnly: true
...

Notes in issues can preserve original user ownership when copied. To do that, you need to

  • have tokens for all users involved
  • add related users as members of the target project beforehand (with at least a Reporter permission)
  • add a users entry into the to target section:
...
to:
  url: https://gitlab.sameorotherdomain.com
  token: anothertoken
  project: namespace/otherproject
  users:
    bob: anothertoken
    alice: herowntoken

Now grab some project stats by running

$ ./gitlab-copy gitlab.yml

If everything looks good, run the same command, this time with the -y flag to effectively copie issues between GitLab instances (they can be the same):

$ ./gitlab-copy -y gitlab.yml

Compile From Source

Ensure you have a working Go 1.5+ installation then:

$ go get -u github.com/gotsunami/gitlab-copy
$ make
  • The program gets compiled into bin/gitlab-copy
  • Cross-compile with make buildall
  • Prepare distribution packages with make dist

License

MIT. See LICENSE file.

gitlab-copy's People

Contributors

matm avatar egmanoj avatar jflemer-ndp avatar aboutofpluto avatar

Watchers

Rohit Yadav avatar  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.