HOWTO migrate tasks from kanboard to phabricator
Kanboard is a Kanban Project Management tool written in PHP. an excellent lightweight tool to quickly set up a project and organize tasks (think of it as a down-to-earth trello).
Phabricator on the other hand is a complete suite of software development collaboration tools, which among others includes a Kanban-like view of tasks tagged with each project.
If you happen to have to migrate tasks from Kanboard to Phabricator, this guide is for you. But beware in the spirit of Phabricator’s creators we have no well-tested tool to offer, just a semi-manual procedure based on Phabricator’s Conduit API.
Log into the server where you have installed Kanboard, and navigate to the data directory inside that:
cd /var/www/kanboard/data
open the sqlite database:
sqlite3 db.sqlite
explore the database schema:
.tables
.schema projects
.schema tasks
find the project (board) you’re interested in
select * from projects;
in our case it was project 3; list tasks and columns from that project:
select id,column_id,title from tasks where project_id=3 order by column_id;
recognize how the column_id field matches the board columns …
Now extract in Python dictionary format the list of tasks, one column at a time (you’ll have to do some manual escaping here !)
-
backlog (that was column_id 9 for us):
select '{"title": "'||title||'", "description": """'||description||'"""},' from tasks where project_id=3 and column_id = 9;
-
ready (column_id 10):
select '{"title": "'||title||'", "description": """'||description||'"""},' from tasks where project_id=3 and column_id = 10;
-
work in progress (column_id 11):
select '{"title": "'||title||'", "description": """'||description||'"""},' from tasks where project_id=3 and column_id = 11;
now copy-paste those in the python script skeleton, replacing the ellipsis dots:
import requests
phabricator_instance = 'phabricator.example.com'
api_token = 'api-aaaaaaaaaaaaaaaaaaaaaaaaaaaa'
projectPHID = "PHID-PROJ-aaaaaaaaaaaaaaaaaaaa"
tasks_backlog = [ ... ]
tasks_ready = [ ... ]
tasks_wip = [ ... ]
def create_task(s, title, description):
data = {'api.token': api_token,
'title': title,
'description': description,
'projectPHIDs[]': [projectPHID]}
url = 'https://' + phabricator_instance + '/api/maniphest.createtask'
req = requests.Request('POST', url, data=data)
prepped = s.prepare_request(req)
resp = s.send(prepped)
resp.raise_for_status()
results = resp.json()
error_info = results['error_info']
if error_info:
print 'internal: error while creating phabricator task: %s' % error_info
return {}
uri = results['result']['uri']
task_id = results['result']['id']
return {"uri": uri, "task_id": task_id}
In this script you also have to modify the phabricator_instance (should be the FQDN of the Phabricator instance where you want to file the task), the api_token (can be obtained as follows: as a Phabricator admin, create a bot account then “Edit Settings”, go to “Conduit API Tokens”, click “Generate API token”) and the projectPHID (the Phabricator ID of the project you want to file your task against; here is how you can find that out)).
Now you’re all set to manually execute one by one the imports, starting from the rightmost column:
s = requests.Session()
for t in tasks_wip:
title = t['title']
description = t['description']
create_task(s, title, description)
each time go to the project work-board in Phabricator and move the newly created tasks in the right column.
This was the starting situation in Kanboard:
And this is the final situation in Phabricator:
Quite a lot of work still to do ! But at least we’ve got titles, descriptions and columns right !