Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continuous integration (CI) with Phabricator?

I tried continuous integration tools Travis CI, CircleCI and codeship, but found none of them provide support document for phabricator. Does anyone have ideas about how to do continuous integration (CI) with Phabricator?

like image 565
Hanfei Sun Avatar asked Dec 17 '14 03:12

Hanfei Sun


2 Answers

I have done an integration with Travis-CI by adding post diff and land hooks to Phabricator to push diffs as branches to GitHub where Travis looks for branch updates. As far as I know, Travis-CI integrates only with GitHub, so if your main repo is there and Phabricator is pointing to it, it can be done.

If you want to take this approach, the place to start is with creating your own ArcanistConfiguration and overriding didRunWorkflow. See also how to create a new library. The API documentation is pretty good, but I had to go through some trial and error to get what I wanted. The Phabricator people are probably happy to answer questions.

You can also look into the Phabricator conduit differential.createcomment to script messages to diffs like so:

arc call-conduit --conduit="https://my.phabricator.com/" --arcrc-file="robot.arcrc" \
  differential.createcomment <<EOF
{"revision_id":"1234","message":"Yer build done failed"}
EOF

Where robot.arcrc is an arcrc file with the credentials to push messages, and 1234 is the revision number. You would have to use the conduit API to get the revision number.

So, I think the answer is you may have to build your own custom solution depending on which CI integration for the CI tool you want to integrate with. And here's a discussion of Travis support for Phabricator.

Edit: Here's traphic, an example of extending arcanist to push diffs to branches on GitHub on arc diff and remove them on arc land. As Travis-CI looks for update from GitHub, it will build your diffs.

Side note: This is mostly a brain dump. I know good answers have more code examples and links are frowned on, but the question was pretty open ended and was looking for pointers, so I'm trying to be helpful.

like image 151
zerodiff Avatar answered Nov 14 '22 10:11

zerodiff


If you are using Jenkins, the nice guys at Uber created a Jenkins Phabricator Differential plugin that makes it possible to really clean up your job configs (if you've already set them up using the links from zerodiff's post).

like image 43
Jonas Arneberg Avatar answered Nov 14 '22 11:11

Jonas Arneberg