Their exports name attachments without carrying the files, so the files were reported as a loss. Each service documents where a file is downloaded, behind the same sign-in as its API: - Jira: fields.attachment[].content (/rest/api/3/attachment/content/<id>), Basic email:API token; Jira's redirect to its media store is followed without the sign-in. - Deck: /index.php/apps/deck/api/v1.0|v1.1/boards/../stacks/../cards/.. /attachments/<id>, Basic user:app password, OCS-APIRequest: true. - OpenProject: _links.downloadLocation, relative to the instance, Basic apikey:<key>. - Asana: GET /attachments/<gid>?opt_fields=download_url with a personal access token, then the signed download_url without it; a file the export embeds (export_boards.pl) is taken as it is; one kept on Google Drive and the like is a link, reported. - GitLab: a private project's /uploads/ link through /api/v4/projects/<id>/uploads/<secret>/<file> (17.4+), Bearer token. The import page asks for the address, user and token under "Attachment files" for these five (the REST import takes the same as attachmentAuth). They go with that one import: held beside the creator in a WeakMap, never stored or logged, the token field emptied on Import, and sent ONLY to the origin the member typed - an export names any URL it likes. Every download is the import's SSRF-guarded fetch, which validates each hop and drops Authorization on a cross-origin redirect. A file that cannot be fetched is on the loss report with its reason. Unticking Attachments leaves them out (Jira's per-issue field is pruned too). Zenkit is left out: it publishes no way to download a file. Tests: importAttachmentAuth.test.cjs (each service's request, the sign-in only to its origin, malformed sign-ins, never stored or logged), the parser tests pin the attachment lists, a Meteor test imports an embedded Asana file onto its card and shows a Jira file is reported without a sign-in and that the sign-in never reaches an address the guard refuses, and import-attachment-auth.e2e.js the page (not run here). Not run against the live services. Thanks to xet7 !
15 KiB
GitLab
WeKan imports the issues of a GitLab project and exports a board as GitLab issues. Both directions use the JSON array that GitLab's Issues API v4 returns for a project. Open issues become cards in an Open list and closed issues cards in a Closed list. Iterations become Scrum sprints and milestones Scrum releases. GitLab has no file export of issues in this shape, so the file is made with the API, and the exported file goes back into GitLab only through the API.
How to import
-
In GitLab, get the issues as JSON with List all project issues, using a personal access token with the
read_apiscope:curl --header "PRIVATE-TOKEN: TOKEN" \ "https://gitlab.com/api/v4/projects/ID/issues?state=all&with_labels_details=true&per_page=100&page=1" > issues.jsonUse your own GitLab server's address instead of
gitlab.comwhen you have one. The API returns the issues a page at a time (pagination): fetch the next pages too and join them into one array (for example withjq -s 'add' page*.json > issues.json). WeKan imports what the file holds. -
Optionally, a script can add to each issue a
notesarray (from the issue's notes) and alinksarray (from the issue's links). WeKan then imports the comments and the links between issues. -
In WeKan, go to All Boards → New → Import → GitLab.
-
Tick the parts to import (Select what to include). Only the ticked parts are imported. Sprints and releases are imported only when Scrum settings is ticked.
-
Paste the JSON into the text box and click Import. There is no member mapping step for GitLab.
-
If anything could not be brought over, the import page shows it under Imported with warnings before it opens the board. The same report is kept in Admin Panel → Problems → Recovery.
The import page says the same: Paste a GitLab issues JSON array (GET /projects/ID/issues). Issues become cards grouped into Open / Closed lists.
How to import many boards at once
- On the import page, under Import many boards, choose several export
files, or one
.zipthat holds them. Each file becomes its own board, imported without member mapping (members can be mapped later). - GitLab is imported through the generalized importer, so the page also offers One board per project: each swimlane the import would create becomes its own board, named after that swimlane. A GitLab import always puts every issue in one swimlane, Default, so for GitLab this option makes no difference. To get one board per project, save each project's issues to its own file and choose all the files. Links (parent cards, dependencies) between cards that end up on different boards are reported in the loss report rather than kept.
- From a script:
python3 api.py importboardsfrom gitlab FILE_OR_DIR ...(files, directories of files, or.zipfiles).
How to export
- In WeKan, open the board, then Board Settings → Export.
- Under Select what to include, tick the parts you want. Tick Scrum settings to write sprints and releases as iterations and milestones.
- Choose GitLab in the JSON list. The board downloads as a
.jsonfile. - GitLab has no import for this file: issues are created through its API.
For each item, call
Create an issue
(
POST /projects/ID/issues) with itstitle,description,labels(comma separated) anddue_date.created_atis accepted only from an administrator or project owner. Close the items with"state": "closed"afterwards with Update an issue (state_event=close). Iterations, milestones and assignees must already exist in GitLab and are given by their ids.
How to export all boards at once
- All Boards → sidebar → Export all boards, choose GitLab: this
downloads one
.zipwith one GitLab issues file per board you can export (boards you are a member of, not archived, not templates). - To export only some boards: Multi-Selection in the All Boards sidebar, select the boards, then Export.
- From a script:
python3 api.py exportallboards gitlab boards.zip.
Format details
From the format coverage audit:
- Authoritative shape: the current Issues API v4.
- Required import coverage: state, labels with details, assignees, author, milestone (as a Scrum release), iteration (as a Scrum sprint), weight, due date, time stats, task completion, links, discussions and attachments.
GitLab (#2698) meets the same
contract as GitHub: every assignee, the author, creation and close dates, time
spent, labels with details, milestone, iteration, issue type and
confidentiality as tags (milestones and iterations are also Scrum releases and
sprints, below), weight, time estimate and task completion as custom fields,
embedded notes as comments (system notes skipped), embedded links as
dependencies, and the group/project#iid reference and web URL at the end of
the description. A confidential issue is warned about, because on the board
the board's visibility decides who reads it. Epics, which are group-level, and
comments that exist upstream but were not embedded are reported in
unsupported. List Sync still writes only title, description and time fields
on existing cards; the others apply when a card is created.
Sprints and releases
GitLab imports create Scrum sprints and releases from what the export really
carries (models/lib/externalScrumPlanning.js), written through the same
journaled Scrum import stage as Jira and WeKan JSON
(server/lib/scrumTransferImport.js), so an interrupted import is recovered
like theirs (Scrum import recovery). The import
page's Scrum settings part decides whether any of it is imported.
- Sprints: an issue's
iteration:title(an untitled cadence iteration is named by its dates, as GitLab shows it),descriptionas the goal,start_date,due_date;state1 /upcomingis planned. - Releases: an issue's
milestone:title,description,start_date,due_date;stateactiveis planned,closedis released. - Also: the
milestone:anditeration:labels stay, because List Sync writes labels and not Scrum planning, and earlier boards filter by them. - Reported, not imported: a current (2) iteration is imported as planned: there is no commitment snapshot. A closed (3) iteration is not imported: there is no commitment or close snapshot. A closed milestone has no close date. Malformed dates, unknown states, untitled milestones, and iterations with neither id nor title are reported.
Two records with the same name stay two records and are reported; one source
id listed on many issues is one record. A card in an iteration that is not
imported stays in the backlog. The GitLab export writes each card's sprint and
release back as iteration and milestone when Scrum settings are selected;
a cancelled sprint or release has no equivalent there and is left out. The
format carries no commitment snapshot, so an exported active or closed sprint
comes back as the import above describes.
What the current code does
The parser is parseGitlab in models/lib/externalParsers.js:
- It accepts an array of issues, or an object with an
issuesarray. - Labels are read as strings or as
with_labels_detailsobjects; only the name is kept, so the labels are black. issue_typeother thanissuebecomes atype:...label, andconfidentialaconfidentiallabel plus a warning.assignees(orassignee): the first is the owner, the rest are further card members, each only when mapped to a WeKan user.weightbecomes the Weight custom field,time_stats.time_estimatethe Time estimate (hours) custom field andtask_completion_statusthe Tasks custom field (done/total).time_stats.total_time_spentbecomes the card's spent time in hours.notesthat are not system notes become comments, written by the importing user with the GitLab author's name at the start.linksbecome dependencies:relates_tois related-to,blocksblocks,is_blocked_byis-blocked-by. They link issues byiidwithin the same import.- The
iidis kept as the card's sync key for List Sync.
The export (gitlab in models/lib/externalExportFormatters.js) writes, for
each card that is not archived: title, description, state (closed when
the list name contains done, closed, complete, archiv or finished, otherwise
opened), labels (names), due_date, and, when the parts are ticked,
assignees (owner first), author, created_at, closed_at (closed items
only), comments as notes, and the sprint and release as iteration and
milestone. It writes no iid, so importing the file again does not add a
second Source: line.
What is kept
| GitLab | WeKan |
|---|---|
| Issue | Card |
state opened / closed |
List Open / Closed |
title, description |
Card title, description |
labels (names) |
Labels (black) |
milestone |
Scrum release, and label milestone:... |
iteration |
Scrum sprint, and label iteration:... |
issue_type other than issue |
Label type:... |
confidential |
Label confidential, and a warning |
due_date, else milestone.due_date |
Due date |
created_at |
Creation date |
closed_at of a closed issue |
End date |
assignees |
Owner and members, when mapped |
author |
Requested By |
weight |
Custom field Weight |
time_stats.time_estimate |
Custom field Time estimate (hours) |
time_stats.total_time_spent |
Spent time (hours) |
task_completion_status |
Custom field Tasks |
notes (not system notes) |
Comments |
links |
Dependencies |
references.full (else #iid), web_url |
Source: line in the description |
iid |
Sync key |
What is not kept
The import reports these on the loss report:
- the parent epic (epics are group-level in GitLab);
- comments that exist on GitLab but were not embedded in the file;
- a confidential issue (imported, with a warning);
- the Scrum cases listed under Sprints and releases above;
- links to issues that are not in the same import.
These are not read: label colors, system notes, and GitLab's time-tracking history beyond the totals.
The import page has no member mapping for GitLab, so assignees and comment
authors become WeKan users only when a membersMapping is sent through the
REST API. Without it, comments are posted by the importing user with the
GitLab author's name at the start.
The GitLab export does not write weight, time estimate, task completion, custom fields, checklists, subtasks, dependencies, attachments, archived cards, or a cancelled sprint or release.
Attachment files
The files linked from an issue and its comments (/uploads/<secret>/<name>)
are downloaded as before. A private project's upload needs a sign-in: under
Attachment files on the import page, give the GitLab address and a personal
access token (scope read_api); the import then downloads each upload of that
GitLab through GET /api/v4/projects/<id>/uploads/<secret>/<name>, which GitLab
17.4 and later document, with the token as Authorization: Bearer.
The address and the sign-in go with that one import: they are sent only to the
address typed there (an export file names any URL it likes, and one pointing
an attachment elsewhere gets no sign-in), never stored and never logged, and
the token field is emptied when Import is pressed. Every download goes through
the import's SSRF guard, which checks each redirect and drops the sign-in on a
redirect to another host, and lands in Admin Panel → Attachments → Default
Storage like any upload. A file that cannot be fetched is on the loss report
with the reason, and the import goes on. Leaving the fields empty imports the
board without its files. Unticking Attachments under what to include
leaves them out too. A service on a private address is refused by the same
guard. models/lib/importAttachmentAuth.js decides what is asked of whom.
Through the REST API (POST /api/boards/import/<source>), send the same as
"attachmentAuth": { "url": ..., "username": ..., "token": ... } beside
"board".
REST API
python3 api.py importboardfrom gitlab issues.json # POST /api/boards/import/gitlab
python3 api.py importboardsfrom gitlab project1.json project2.json
python3 api.py exportboardformat BOARDID gitlab issues.json # GET /api/boards/BOARDID/export/gitlab
python3 api.py exportallboards gitlab boards.zip # GET /api/export-all-boards/gitlab?authToken=...
POST /api/boards/import/gitlab takes the issues array as the body, or as
{ "board": [...] }, with an optional membersMapping. The mass export route
takes an optional &boardIds=ID1,ID2 to export only those boards.
How it is built and tested
models/lib/externalParsers.js(parseGitlab) reads the issues;models/lib/externalScrumPlanning.js(gitlabScrumPlanning) reads the sprints and releases;models/kanboardCreator.jswrites the board.models/lib/externalExportFormatters.js(gitlab) writes the export;models/lib/externalExporters.jscollects the board, with its sprints and releases.- Unit tests:
tests/gitlabImport.test.cjs,tests/externalScrumPlanning.test.cjs,tests/externalExportRoundTrip.test.cjs,tests/importFormatAudit.test.cjs. - Playwright:
tests/playwright/specs/gitlab-scrum-import.e2e.js(an iteration and a milestone import as a sprint and a release and export back; a closed iteration is reported and not invented; without Scrum settings no sprints or releases are made) andtests/playwright/specs/import-export-format-audit.e2e.js(fixture import, malformed JSON, the export menu link).
Sources
- Issues API: listing and creating
issues, the iteration, milestone, weight, time stats and task completion
fields, and the
created_atandiidrights - REST API: pagination, fetching every page
- Notes API: an issue's comments
- Issue links API: the links between issues
- Personal access tokens: the token for the API
See also: format coverage, all formats.