A CI workflow for arcanist and testing of Docker images.
This project provides scripts that enable one to leverage Buildbot CI (Continuous Integration) with Phabricator’s Harbormaster. Any code review in Phabricator triggers a change_hook
request in buildbot and it runs the docker build
and docker run
command in the buildbot instance. Build results will be sent to Phabricator using the scripts in this repository. This way, utility docker images can be tested in an automated fashion as part of a development workflow.
Here are the steps in the workflow:
- Programmer submits code for review by committing changes and running an
arc diff
(Differential) - Code review triggers Herald rules which triggers a Harbormaster build plan
- Harbormaster build plan makes HTTP requests to remote builders and can wait for status report from the builders. Status will be reported back to Herald.
- If a repository has a staging area, Differential (code review) will create a new tag for the review and that tag will be pushed to the staging repository.
- A push to the staging repository triggers the
change_hook
. - Buildbot's
change_hook
will use the tag to checkout and build the repository. - Build report is sent to Harbormaster and then to Herald.
- Finally, the build status will be visible in the Differential review page.
- Setup Buildbot with http://docs.buildbot.net/current/tutorial/tour.html
- Install Docker in the buildbot instance: https://docs.docker.com/engine/install/
- Setup Phabricator with https://secure.phabricator.com/book/phabricator/article/installation_guide/
- Create a Harbormaster build plan with https://secure.phabricator.com/book/phabricator/article/harbormaster/
- In the build instructions, make a HTTP POST request to your buildbot instance
http://<your_buildbot_url>/change_hook?project=<your_project_name>&repository=${repository.staging.uri}&revision=${buildable.diff}&PHID=${target.phid}&author=s&comments=''"
- Create a Herald rule for repository actions such as push, code review, etc. with https://secure.phabricator.com/book/phabricator/article/herald/
- Place the shell scripts in this repository in the desired place in the buildbot instance
- Modify
master.py
in Buildbot instance to add required build steps http://docs.buildbot.net/latest/manual/configuration/buildsteps.html - Call
fetchRevision.sh
to fetch the right review tag. - Call
docker build
anddocker run
commands to build the image and run the container. - Call the
hbSendSuccess.sh
orhbSendFailure.sh
scripts if the build passes or fails inmaster.py
. - If build is successful, you can also have a build step to push to your docker registry.