This plugin provides Phabricator integration with Jenkins. It allows Jenkins to report build status and coverage information over Harbormaster (or via comments if Harbormaster is not enabled).
First, create a bot user and generate a Conduit API token for your Phabricator
install. This lives at https://phabricator.example.com/settings/panel/apitokens/
.
Next, navigate to https://ci.example.com/configure
, replacing ci.example.com
with the URL for your Jenkins instance.
Enter your Conduit credentials by clicking "Add" and selecting "Phabricator Conduit Key".
Fill in your "Phabricator URL" with the base
URL of your phabricator install, for example https://phabricator.example.com
.
Enter the conduit token for your Jenkins bot user (create one if necessary). Add a
Description for readability.
To enable Harbormaster integration, add two string parameters to your jenkins
job: DIFF_ID
and PHID
:
To apply the differential to your workspace before test runs, enable the "Apply Phabricator Differential" step under "Build Environment":
By default, this will reset to the base commit that the differential was made from. If you wish to apply the patch to master instead, select "Apply patch to master".
To report the build status back to Phabricator after your test run, enable the "Post to Phabricator" Post-build Action:
If you have Uberalls enabled, enter a path to scan for cobertura reports.
Once the plugin is configured, you will want to enable harbormaster via herald rules to trigger jenkins builds on differentials.
First, create a new Harbormaster build plan with a single step, "Make an HTTP POST request":
Set the URI to
https://ci.example.com/buildByToken/buildWithParameters?job=test-example&DIFF_ID=${buildable.diff}&PHID=${target.phid}
,
replacing https://ci.example.com
with the URI of your Jenkins instance, and
test-example
with the name of your job. If your Jenkins instance is exposed to
the internet, make sure to install the Build Token Root Plugin and fill in
the token
parameter.
Set the "When Complete" dropdown to "Wait For Message"
To allow projects to post back additional text instead of just pass/fail, the
plugin supports a build comment file, which defaults to
.phabricator-comment
. Put text in here, and Jenkins will add it to the build
status comment.
Next, create a Global herald rule:
Fill in your repository name and build plan.
Try arc diff
-ing on your repo. If everything goes well, you should see Jenkins
commenting on your diff:
Set up your maven file according to https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
Start up Jenkins with the plugin installed
mvn hpi:run
Open your browser to your local instance
Please open all pull requests / issues against https://github.com/uber/phabricator-jenkins-plugin
MIT Licensed