README ¶
Lighthouse to GitLab migrator
This is a Go program which can be used to migrate data from a
Lighthouse export file generated using the lh export
command to
GitLab (see
cmd/lh).
It migrates all Lighthouse users, projects, milestones and tickets
contained within the export file.
Installation
go get -u github.com/nwidger/lighthouse/cmd/lhtogitlab
Usage
Run lhtogitlab
with no arguments for usage help:
$ lhtogitlab
Usage of lhtogitlab:
-base-url string
GitLab base URL to use (i.e., https://gitlab.example.com/)
-delete
Delete all GitLab projects and users (except user owning API token -token) before importing
-groups string
Path to JSON file containing GitLab groups to create
-insecure
Allow insecure HTTPS connections to GitLab API
-milestone string
Only migrate milestones with the given title (useful for testing)
-number int
Only migrate tickets with the given number (useful for testing)
-password string
Password to use when creating GitLab users (default "changeme")
-project string
Only migrate projects with the given name (useful for testing)
-token string
GitLab API token to use
-users string
Path to JSON file mapping Lighthouse user ID's to GitLab users
Required arguments are -base-url
, -token
and -users
. See the
next two sections for the expected format of the file specified by
-users
and -groups
. The final argument to lhtogitlab
must be
the path to a Lighthouse export file generated by the lh export
command.
See cmd/lh
for more details about the usage of the lh export
command.
Users File
The -users
argument specifies a path to a JSON file mapping
Lighthouse user ID's to GitLab users. Each user will be created in
GitLab using the name, username and email fields provided. See below
for an example:
{
"123": {
"email": "bob@example.com",
"username": "bob",
"projects_limit": 100000,
"name": "Bob Bobbington",
"is_admin": true,
"external": false,
"can_create_groups": true
},
"456": {
"email": "fred@example.com",
"username": "fred",
"projects_limit": 100000,
"name": "Fred Freddington",
"is_admin": true,
"external": false,
"can_create_groups": true
},
"789": {
"email": "bil@example.com",
"username": "bill",
"projects_limit": 100000,
"name": "Bill Billington",
"is_admin": true,
"external": false,
"can_create_groups": true
}
}
Groups File
The -groups
argument specifies a path to a JSON file containing an
array of GitLab groups to create. Each group will be created in
GitLab using the name, path and description fields provided.
Lighthouse projects with a matching name in the projects
array will
be created within the given GitLab group. Lighthouse users with a
matching name in the members
array will be added as members within
the given GitLab group. See below for an example:
[
{
"name": "Foo Bar",
"path": "foo-bar",
"description": "Foo bar",
"projects": [
"Foo Bar Project",
"Foo Bar Project 2"
],
"members": [
"Bob Bobbington",
"Fred Freddington"
]
},
{
"name": "Foo Buz",
"path": "foo-buz",
"description": "Foo buz",
"projects": [
"Foo Buz Project"
],
"members": [
"Fred Freddington"
]
},
{
"name": "Foo Buq",
"path": "foo-buq",
"description": "Foo buq",
"projects": [
"Foo Buq Project"
"Foo Buq Project 2"
"Foo Buq Project 3"
],
"members": [
"Fred Freddington",
"Bill Billington"
]
}
]
Output
The tool prints a line to standard out for each user, project, milestone and ticket it migrates. Errors are printed to standard error. The tool returns with a zero status code if the migration was successful.
Documentation ¶
There is no documentation for this package.