Skip to main content

buildbot-phorge integration

Project description

Buildbot-Phorge integration

Buildbot is a wonderful automation framework, Phorge is a community fork of Phabricator, a wonderful review and CVS hosting tool.

Sadly they don't talk too well to eachother. This aims to fix that.

Setting up Buildbot

Install this package from pypi into the same environment that your buildbot-master runs on.

Change Hook

This component is required in order to tell Buildbot about a new changeset.

Similarly to other Buildbot Change Hooks, we configure it in c["www"].

To set up the hook, we need the Phorge host, a secret to authenticate such host against Buildbot and a Conduit API token to authenticate Buildbot against Phorge in order to fetch additional data.

Example

# We use this to fetch additional data form Phorge's Conduit API
phorge_host : str = "we.phorge.it"
# Phorge uses HTTP Basic Authentication, the value of phorge_host will be
# username and the value of bb_token (may be a secret) will be the password
# This has to be set up in Phorge
bb_token : Union[str, Secret] = util.Secret("we.phorge.it.bb_token")
# Phorge doesn't send us all necessary data for the build, so we have to fetch
# it using the Conduit API, for which we need this token. It may be a secret
conduit_api_token: Union[str, Secret] = util.Secret("we.phorge.it.api_token")

# And the actual bits, when setting up the 'www' plugin, change_hook_dialects
# must be set up in a similar fashion to this.
c["www"] = dict(
	[...]
	change_hook_dialects=dict(phorge={
		"credentials": {
			phorge_host: (bb_token, conduit_api_token)
		}),
	[...]
)

Reporter

In order to notify Phorge about the result of builds, we need a Reporter.

Currently due to Conduit API limitations, no information other than PASS and FAILED can be sent.

Example

# Import the necessary class
from buildbot_phorge import PhorgeReporter

# Here we only need phorge_host and conduit_api_token, as for the hook
# Remember conduit_api_token may be a Secret.
c["services"].append(PhorgeReporter(token=conduit_api_token, host=phorge_host))

Setting up Phorge

In Phorge you have to setup a Build Plan for Harbormaster. Depending on your setup, you may only need one Build Step that triggers buildbot, as Buildbot is much better at automation.

This is Build Step of type Make HTTP Request.

As far as we can see, there is no option to pass arguments over POST requests, so we pick HTTP Method GET.

Add some secure Credentials which will be checked on Buildbot.

Remember that the User must match your Phorge hostname!

Setup When Complete as Wait For Message, Buildbot should tell Phorge about the result of the build afterwards.

The tricky bit is the URI setting, we have to pass all the information that Buildbot will need to trigger the build and let Phorge know about its result.

The URI should look like this (change ${CI_HOST} for your Buildbot hostname)

# Set this Build Step URI on Phorge
https://${CI_HOST}/change_hook/phorge?id=${build.id}&t=${target.phid}&ts=${step.timestamp}&u=${repository.uri}

Future work

This can still be improved but it works wonderfully as-is for us.

Still, there are some things that you can hack / improve.

Use the ${buildable.diff} to trigger builds on Reviews / Diffs

Use the ${buildable.revision} to trigger builds on Revisions / Audits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buildbot-phorge-0.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

buildbot_phorge-0.0.1-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file buildbot-phorge-0.0.1.tar.gz.

File metadata

  • Download URL: buildbot-phorge-0.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for buildbot-phorge-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b19a9085230133bf1a0c642676c169fb2f5f780dd189013ec79d779f0a8e1975
MD5 27b2ef080382fe1fd7ea8e0f690bf1bb
BLAKE2b-256 6b4da383b597b02f25995dda54c353b1ddaddc8e9d47e7daaa623b4fc5b51567

See more details on using hashes here.

File details

Details for the file buildbot_phorge-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for buildbot_phorge-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6d374a0cdd443e4a2a6315762f9435495a43b19739fd82968da776bc432a78e2
MD5 e18d4d16e1f1b57b5a12d0d3cabd8498
BLAKE2b-256 d0b2abe8b229971999a5aa7951341122739d0da143a689f6de80bf60707dc051

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page