buildkite/buildkite-phabricator-dev

Name: buildkite-phabricator-dev

Owner: Buildkite

Description: A Dockerized environment for developing and testing our Buildkite patches branch of Phabricator

Created: 2017-06-05 07:35:49.0

Updated: 2017-06-05 07:36:02.0

Pushed: 2017-06-05 07:47:01.0

Homepage: null

Size: 15

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

buildkite-phabricator-dev

A Dockerized environment for developing and testing our buildkite-patches branch of Phabricator.

Get Started
one this repo
clone https://github.com/buildkite/buildkite-phabricator-dev.git
uildkite-phabricator-dev

side, clone our patches branch and other phabricator libs
clone -b buildkite-patches https://github.com/buildkite/phabricator.git
clone https://github.com/phacility/libphutil.git
clone https://github.com/phacility/arcanist.git

art it all up (it will automatically bootstrap the DB)
er-compose up

tup up Pow, or somesuch localhost proxy
 '8081' > '~/.pow/phabricator'

ve it a go (don't create a user! Read the next step)
 http://phabricator.dev/

Next we've got to setup and configure Phabricator with a user, repository, build plan and herald rule.

1. Setup a user
2. Create a Repository
3. Clone, commit and push

Next step is to clone the repository to test inside this repository's checkout path (don't worry, test is gitignore'd):

t clone http://phabricator.dev/diffusion/1/test.git
ing into 'test'...
ing: You appear to have cloned an empty repository.
 test
uch Readme.md
t commit -am "Initial commit"
ter (root-commit) 7341547] Initial commit
ile changed, 0 insertions(+), 0 deletions(-)
ate mode 100644 Readme.md
t push origin master
ting objects: 3, done.
ing objects: 100% (3/3), 841 bytes | 0 bytes/s, done.
l 3 (delta 0), reused 0 (delta 0)
ttp://phabricator.dev/diffusion/1/test.git
new branch]      master -> master
4. Setup Arcanist

The arc command line tool is used to create a Diff for code review.

canist/bin/arc help

Add it to your $PATH if you want to make it easier to use:

rt PATH="$PATH:~/Codez/buildkite-phabricator-dev/arcanist/bin"

You'll need to authenticate it:

c install-certificate http://phabricator.dev/
NECT  Connecting to "http://phabricator.dev/api/"...
N TO PHABRICATOR
 this page in your browser and login to Phabricator if necessary:

://phabricator.dev/conduit/login/

 paste the API Token on that page below.

Paste API Token from that page: xxx
ing ~/.arcrc...
CESS!  API Token installed.

Now you can create your first diff! Going back into the test repository:

est
 '{"phabricator.uri": "http://phabricator.dev/"}' > .arcconfig
add .
commit -m "First diff commit"
diff
te: be sure to add some words to the "Test Plan" section

You'll now have your first diff: http://phabricator.dev/D1

5. Setup a Harbormaster Build Plan

This is what triggers a Buildkite build.

Now you add a build step:

6. Create a Herald Rule

Herald is used to trigger build plans automatically when new diff revisions are submitted:

Next we create one for when commits are pushed:

Now you can create another arc diff, or push a build, and see it trigger harbourmaster builds.

7. View and restart builds

In Harbormaster you'll be able to see the builds triggered. You can restart them to resend the payloads to Buildkite.

http://phabricator.dev/harbormaster

Helpful development snippets

If you want to send the Buildkite webhooks to https://requestb.in/, modify the HarbormasterBuildkiteBuildStepImplementation.php like so, and then hit “Restart Build” in Phabricator:

 $organization = $this->getSetting('organization');
 $pipeline = $this->getSetting('pipeline');

 $uri = urisprintf(
   'https://api.buildkite.com/v2/organizations/%s/pipelines/%s/builds',
   $organization,
   $pipeline);
 $uri = urisprintf('https://requestb.in/xxx');

 $data_structure = array(
   'commit' => $object->getBuildkiteCommit(),

Getting a bash prompt to run phabricator commands:

er-compose run --rm phabricator bash

Tailing the phd worker logs:

er-compose exec phabricator tail -f /var/tmp/phd/log/daemons.log
License

MIT (see LICENSE)


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.