Skip to main content

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

Metadata

Release files for buildbot-phorge 22.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for buildbot-phorge 22.8.0
File Size Uploaded Provenance Actions
buildbot-phorge-22.8.0.tar.gz 7.4 kB Without provenance Details for buildbot-phorge-22.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for buildbot-phorge 22.8.0
File Interpreter ABI Platform Actions
buildbot_phorge-22.8.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for buildbot_phorge-22.8.0-py2.py3-none-any.whl

Total release size: 15.9 kB

Release files / buildbot-phorge-22.8.0.tar.gz

Download URL buildbot-phorge-22.8.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4579801e878e32cd83cec44635f3ec3714832b8e1547496e20bd006797876a45
BLAKE2b-256 checksum
How to use checksums
ba37c5703c8b07a98e158defaa12acc1d96e43e0addcf93eb05a4759f4b811c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / buildbot_phorge-22.8.0-py2.py3-none-any.whl

Download URL buildbot_phorge-22.8.0-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8b05a5c76694a0bd5e88da2140d10768419dd60c15664d00656c17729a5b9459
BLAKE2b-256 checksum
How to use checksums
64761554323462aad74a8a1dc6486335aa71eae479581fca19e3e53d4ed122ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Security for buildbot-phorge 22.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

22.8.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page