-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -state-key CLI argument to lhtogitlab
Add -state-key new CLI argument to lhtogitlab to allow customizing the GitLab scoped label key used to map Lighthouse ticket states to GitLab labels. Remove unneeded functionality from lhtogitlab Don't bother reading bins, changesets or messages from LH export archive since we don't do anything with them. Also, don't read all ticket attachments into memory at start of migration since this consumes far too much memory.
- Loading branch information
Niels Widger
committed
Mar 23, 2020
1 parent
15b4aaa
commit 99916b5
Showing
2 changed files
with
380 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ Usage of lhtogitlab: | |
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 | ||
|
@@ -42,14 +44,15 @@ Usage of lhtogitlab: | |
``` | ||
|
||
Required arguments are `-base-url`, `-token` and `-users`. See the | ||
next section for the expected format of the file specified by | ||
`-users`. The final argument to `lhtogitlab` must be the path to a | ||
Lighthouse export file generated by the `lh export` command. | ||
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](https:/nwidger/lighthouse/blob/master/cmd/lh) | ||
for more details about the usage of the `lh export` command. | ||
|
||
## Users Map | ||
## 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 | ||
|
@@ -59,23 +62,88 @@ for an example: | |
``` json | ||
{ | ||
"123": { | ||
"name": "Bob Bobbington", | ||
"email": "[email protected]", | ||
"username": "bob", | ||
"email": "[email protected]" | ||
"projects_limit": 100000, | ||
"name": "Bob Bobbington", | ||
"is_admin": true, | ||
"external": false, | ||
"can_create_groups": true | ||
}, | ||
"456": { | ||
"name": "Fred Freddington", | ||
"email": "[email protected]", | ||
"username": "fred", | ||
"email": "[email protected]" | ||
"projects_limit": 100000, | ||
"name": "Fred Freddington", | ||
"is_admin": true, | ||
"external": false, | ||
"can_create_groups": true | ||
}, | ||
"789": { | ||
"name": "Bill Billington", | ||
"email": "[email protected]", | ||
"username": "bill", | ||
"email": "[email protected]" | ||
"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: | ||
|
||
``` json | ||
[ | ||
{ | ||
"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, | ||
|
Oops, something went wrong.